0% found this document useful (0 votes)
21 views3 pages

Ada Labc

Uploaded by

poori.2819.hapo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views3 pages

Ada Labc

Uploaded by

poori.2819.hapo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

मौलाना आज़ाद राष्ट्रीय प्रौद्योगिकी संस्थान, भोपाल – 462003

MAULANA AZAD NATIONAL INSTITUTE OF TECHNOLOGY, BHOPAL – 462003

कं प्यूटर विज्ञान एवं अभियांत्रिकी विभाग


(Department of Computer Science and Engineering)

(Practicals)
(S. No.)

Write a program in a programming language of your choice to find all prime


numbers up to a given positive integer 'N' using the Sieve of Eratosthenes algorithm.
Additionally, analyze and provide the time complexity of your implementation.
Explain how the time complexity is derived and how it depends on the input size 'N'.

Sieve of Eratosthenes Algorithm:


ALGORITHM Sieve(n)
//Implements the sieve of Eratosthenes
//Input: A positive integer n ≥ 2
//Output: Array L of all prime numbers less than or equal to n
for p ← 2 to n do A[p] ← p
for p ← 2 to [√n] do // p hasn’t been eliminated on previous passes
j←p*p
(Lab-1) while j ≤ n do
A[j] ← 0 //mark an element as eliminated
J←j+p
//copy the remaining elements of A to array L of the primes
i←0
for p ← to n do
if A [p] ≠ 0
L[i] ← A[p]
i←i+1
return L

Write a program to multiply two matrices of size n*n and count the total no of
program steps using the count method and plot the graph for how time complexity
varies with the increasing size of matrices, also do an analysis of the actual time
taken to perform the matrix multiplication using time() function.
(Lab-2)
Write a program to find the transpose of the matrix and count the total no of
program steps using the count method and plot the graph for how time complexity
varies with the increasing size of matrices.
मौलाना आज़ाद राष्ट्रीय प्रौद्योगिकी संस्थान, भोपाल – 462003
MAULANA AZAD NATIONAL INSTITUTE OF TECHNOLOGY, BHOPAL – 462003

कं प्यूटर विज्ञान एवं अभियांत्रिकी विभाग


(Department of Computer Science and Engineering)

Write a program to compare Binary search and Ternary search in terms of the number of
(Lab-3)
comparisons done by each. Do this experimentally by plotting a graph and theoretically by
analyzing the Algorithm.

Write a program to implement Merge sort using a Link array.


(Lab-4)

Write a program to implement Quick Sort using random pivot.


(Lab-5)

(Lab- Write a program to implement Quick Sort using the median of three pivots.
6)

Write a program to implement Quick Sort using insertion sort ( for n > 4, quick sort
N<= 4, insertion sort)
(Lab-7)

Analyze the improvement in the quick sort algorithm using this modification.(prog
(Lab- 5,6,7)
8)

(Lab- Write a program to implement Strassen’s matrix multiplication


9)

(Lab-
10)
मौलाना आज़ाद राष्ट्रीय प्रौद्योगिकी संस्थान, भोपाल – 462003
MAULANA AZAD NATIONAL INSTITUTE OF TECHNOLOGY, BHOPAL – 462003

कं प्यूटर विज्ञान एवं अभियांत्रिकी विभाग


(Department of Computer Science and Engineering)

Write a program to implement the multiplication of long integers.

Write a program to implement a defective coin problem which involves the


identification of a defective coin, if any, and ascertaining the nature of the defect
(lighter/heavier) from a set of coins containing at most one defective coin.
(Lab-
11)

Write a program to implement Prim's method for MST in a graph (E, V) using heaps.
(Lab-12)

(Lab- Write a program to implement to a minimum cost spanning tree of a graph using
13) Kruskal’s algorithm using heaps.

Write a program to implement Change – making problem using a greedy algorithm


(Lab-14) when (1) the cashier has only a limited number of coins. (2) the cashier has an
unlimited supply of coins. The value of coins will be like (1,5,10,20,50…paise)

(Lab-
Write a program to implement all pair shortest paths using dynamic programming.
15)

(Lab- Write a program to implement Multi stage graph problem using dynamic
16) programming.

You might also like