Professional Documents
Culture Documents
Assignment
Instructions:
1. I don’t like stories so please stay focussed and give logics to support your theory
2. Anything without logic is illogical, hence it will carry zero marks.
3. Try to put your answers in this document. If you are doing it on paper, attach a picture of
your answer under the respective question.
Question 1: (4 Marks)
Find out worst-case complexity in terms of Big-Oh for the following function. [Note:
here n is always greater than 10]
Question 2: (8 Marks)
Here is an array which has been partitioned by the first step of quicksort. Which of
these elements could be the pivot? (There may be more than one possibility)
4 2 7 10 9 15 36 26 27 21 46 17 19 50 58
Question 4: (2 Marks)
Every node in a tree has 4 children except leaf nodes and the depth of the tree is 8.
Each node occupies 20 bytes of memory, How much maximum memory BFS will
occupy to traverse the whole tree.
Question 5: (4 Marks)
You have an array of n elements. The first half of its elements are already sorted.
Compute the worst-case complexity of implementing insertion sort on the provided
array. Prove your answer with mathematical calculations.