DSA Assignment
DSA Assignment
Assignment
II Semester
Data Structures and Algorithms (20MCA22)
Submitted by
Group 15
ASHISH BISHT 1RV20MC012
RAMYA R AMBEKAR 1RV20MC084
PRAVEEN M 1RV20MC073
KALLAMMANAVAR
LIKITHA S 1RV20MC037
September-2021
RV COLLEGE OF ENGINEERING®
(Autonomous Institution Affiliated to VTU, Belagavi)
R.V. Vidyanikethan, Bengaluru-560059
DEPARTMENT OF MASTER OF COMPUTER APPLICATIONS
CERTIFICATE
This is to certify that have successfully completed ASHISH BISHT 1RV20MC012, RAMYA
R AMBEKAR 1RV20MC084, PRAVEEN M KALLAMMANAVAR 1RV20MC073,
LIKITHA S 1RV20MC037 Assignment on Data Structures and Algorithms (20MCA22) in
partial fulfillment of II semester MCA for the academic year 2020-2021.
MARKS
USN Name Max Assignment – Assignment - Final
Marks 1 2 Marks
1RV20MC012 ASHISH BISHT
1RV20MC084 RAMYA R
AMBEKAR
1RV20MC073 PRAVEEN M 30
KALLAMMANAVAR
1RV20MC037 LIKITHA S
def fibonacci(n):
a=0
b=1
if n < 0:
print("Incorrect input")
elif n == 0:
return a
elif n == 1:
return b
else:
for i in range(2,n+1):
c=a+b
a=b
b=c
return b
num=int(input(“Enter the number:”))
print(fibonacci(num))
Using power of the matrix {{1, 1}, {1, 0}}
def fib(n):
F = [[1, 1], [1, 0]]
if (n == 0):
return 0
power(F, n - 1)
return F[0][0]
F[0][0] = x
F[0][1] = y
F[1][0] = z
F[1][1] = w
O(1)
ϴ(log2n)
ϴ(log2n)
Divide and
3. Merge Sort O(nlog2n) ϴ(nlog2n) O(nlog2n)
Conquer
The partition
The partition The average process
process always case of always picks
picks greatest quicksort is not the middle
or smallest when the pivot element as
Divide and
4. Quick Sort element as is the median pivot.
Conquer
pivot. element.
Prim’s O((V+E)log
7. Greedy - -
Algorithm V)
Floyd–
Dynamic
8. WarshallAlgor O(n3) O(n3) O(n3)
Programming
ithm