Uploaded by 20-CSE-132 Rohit Sachan

Assignment 01

advertisement
Assignment: #1
Paper Name: Data Structure & Algorithm
Paper Code: PCC-CS 301
[Answer all question]
1. Show that the function defined by
𝑓(1) = 1
1
𝑓(𝑛) = 𝑓 (𝑛 − 1) + 𝑓𝑜𝑟 𝑛 > 1
𝑛
Has the complexity O (log n).
2. Define Big O, Ω, Ɵ Notation.
3. Suppose an array A [-15, -14, ……..., 63,64] stored in a memory
whose starting address is 459. Assume, that the word size for
each element is 2
a) How many numbers of the elements are there in the array A?
b) If one word of the memory is equal to 2 bytes, then how
much memory is required to store the entire array.
c) What is the location for A [50]?
d) What is the location of the 10th element?
e) Which element is located at the address 589?
4. What is the advantage of binary search over linear search?
5. Compare Iteration & Recursion with suitable example.
6. “The designer of an algorithm needs to balance between space
complexity & time complexity”- comments on the validity of
the statement in the context of recursive algorithms.
Download