This document summarizes the time complexities of various data structures and sorting algorithms. For data structures, it lists the time complexities for operations like search, insert, and delete for linked lists, min-heaps, arrays, binary trees, AVL trees, and digital trees. For sorting algorithms, it provides the time complexities and descriptions of heapsort, mergesort, and quicksort.
This document summarizes the time complexities of various data structures and sorting algorithms. For data structures, it lists the time complexities for operations like search, insert, and delete for linked lists, min-heaps, arrays, binary trees, AVL trees, and digital trees. For sorting algorithms, it provides the time complexities and descriptions of heapsort, mergesort, and quicksort.
This document summarizes the time complexities of various data structures and sorting algorithms. For data structures, it lists the time complexities for operations like search, insert, and delete for linked lists, min-heaps, arrays, binary trees, AVL trees, and digital trees. For sorting algorithms, it provides the time complexities and descriptions of heapsort, mergesort, and quicksort.
LinkedList O(N) if searching O(1) if adding to front O(N) if adding to end with no trailer node O(1) if adding to end with trailer node Min-Heap O(log2 N) for insertion, deletion, and search O(N) if offline (given all values at once) Arrays O(N) to search O(1) to insert value at index Binary Trees O(log2 N) search O(N) worst case AVL (Adelson-Velskii and Landis) Trees O(log N) worst case for searching, adding, etc (Special kind of BST with order and structure properties) Digital Trees O(M log N) Insertion Sort O(N^2) worse case O(N) best case
Type Time Complexity/Details
HeapSort O(N log2 N) In-Place Unstable Guaranteed to run in O(N log2 N) Guaranteed to run slowest of O(N log2 N) sorts Done in place, but not stable. MergeSort O(N log2 N) Not in-place (requires an equal sized array) Stable Guaranteed to run in O(N log2 N), but typically runs slower than QuickSort. Not in place, but stable. QuickSort Best/Average are O(N log2 N) Worst is O(N^2) In-place O(N^2) comparisons and movement worst case, O(N log 2N) on average. Unstable Not guaranteed to run O(N log2 N), with O(N^2) in bad cases. If choose good pivot, then it will run well. Can be done in place, but not stable. Uses little space.