Consider a completely skewed (left / right) binary search tree with n elements. What is the worst case time complexity of searching an element in this tree?
(A) Arrays, (C) Heap Data Structure, and (D) Linked List
Explanation:
Arrays:
Unsorted Array: Insertion is O(1), Deletion is O(n).
Sorted Array: Insertion is O(n), Deletion is O(1).
Heap Data Structure:
Binary heaps are commonly used for efficient implementation.
Insertion and Deletion take O(log n) time.
Linked List:
Can be implemented as sorted or unsorted.
Efficiency depends on the choice of implementation.
Why not Fibonacci Tree?
Fibonacci trees are not used directly for priority queues. However, Fibonacci heaps (a separate data structure) can implement priority queues efficiently.
1
Match List – I with List – II
List - I (Algorithms)
List - II (Complexity)
(A) Bellman - Ford algorithm (with adjacencylist representation)
(I) O(|V|2)
(B)
Dijkstra Algorithm
(II) O((V+E) logV)
(C)
Prim’s Algorithm
(III) O(mn)
(D)
Topological sorting (with adjacency list representation)
(IV) O(m+n)
Choose the correct answer from the options given below: