- ASelection sort
- BQuick sort
- CInsertion sort
- DHeap sort
Time Taken:
Correct Answer:
Wrong Answer:
Percentage: %
Insertion sort is a stable sorting algorithm, meaning that it preserves the relative order of equal elements in the sorted output. When two elements have equal keys, their original order is maintained after sorting. In contrast, selection sort, quick sort, and heap sort do not guarantee this property.
Bubble sort is a simple comparison-based sorting algorithm that repeatedly steps through the array, compares adjacent elements, and swaps them if they are in the wrong order. In the worst case, where the array is sorted in reverse order, each pass of the algorithm will result in the largest unsorted element "bubbling" to the end of the array. This requires n-1 comparisons in the first pass, n-2 in the second pass, and so on, resulting in a quadratic time complexity of O(n^2).
The breadth-first search (BFS) algorithm has a time complexity of O(V + E) in a graph.
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.
Searching an element in a balanced binary search tree has a time complexity of O(log N), where N is the number of nodes.
Counting sort has a time complexity of O(N + k), where N is the number of elements and k is the range of input values.