- A O(N)
- B O(log N)
- C O(N^2)
- D O(N log N)
Merge sort has a time complexity of O(N log N), making it a stable and efficient sorting algorithm.
Selection sort has a time complexity of O(N^2), making it less efficient compared to other sorting algorithms for large datasets.
Shell sort has a time complexity of O(N^2) in its worst-case scenario, depending on the gap sequence chosen.
The push operation in a stack has a constant-time complexity of O(1), making it efficient for adding elements to the top of the stack.
In the best-case scenario, the time complexity of bubble sort is O(N), making it efficient for already sorted lists.
The pop operation in a queue has a constant-time complexity of O(1), making it efficient for removing elements from the front of the queue.
In the worst-case scenario, a hash table may have a time complexity of O(N) for searching an element, depending on collisions and hash function behavior.
Merge sort has a time complexity of O(N log N), making it a stable and efficient sorting algorithm.
Searching an element in a balanced binary search tree has a time complexity of O(log N), where N is the number of nodes.
The union operation in a disjoint-set with path compression has a time complexity of O(log N), where N is the number of elements.