Dsa Model
Dsa Model
2) Construct the recurrence tree for the equation T(n) = aT(n/b) + f(n).
• The recurrence tree has a subproblems, each of size n/b. The cost at each
level of the tree is f(n).
The depth of the tree is log_b(n), and the total cost is O(n^log_b(a)) if f(n) is
polynomial or O(f(n)) if it dominates.
6) Which Sorting techniques have the time complexity of O(n log n)?
• Quick Sort: Best and average case time complexity is O(n log n).
• Merge Sort: Has a time complexity of O(n log n) for all cases due to its
divide-and-conquer approach.
14) b)
(i)
https://www.tutorialspoint.com/data_structures_algorithms/tree_traversal.htm
(ii) A Binary Tree Data Structure is a hierarchical data structure in which each
node has at most two children, referred to as the left child and the right child. It
is commonly used in computer science for efficient storage and retrieval of data,
with various operations such as insertion, deletion, and traversal.