You are on page 1of 1

Data structures CAT 1

a. The T(n) for worst-case scenarios of a quick sort when the pivot is always the smallest
element is T (n) = T (n – 1) +C n n > 1 find its complexity(10 marks)
b. The binary search sequence n, n/2, n/4, ..., 8, 4, 2, 1. Show that the time complexity is of
O(log n) (10 marks)

c. using the array below how binary search works when searching an item that does not
exist in the array. Compare the time complexities if the item being searched was 101
(4 marks)

d. Using pointers write a program for enqueue and dequeue (5 marks)


e. Using example discusses (6 marks)
I. Backtracking
II. Branch and bound
III. Greedy algorithms

You might also like