Complexity Analysis Flashcards
Implementation of Binary Search Tree
Children Pointers
BST insert
0(n)
BST delete
O(n)
BST Search
O(n)
BST deleteMin
O(n)
BST deleteMax
O(n)
Building BST using insert
O(n^2)
Building optimal BST using dynamic programming algorithm
O(n^3)
Implementation of 2-3 Tree
Children/parent pointers
2-3 Tree insert
O(lgn)
2-3 Tree delete
O(lgn)
2-3 Tree search
O(lgn)
2-3 Tree findMin
O(lgn)
2-3 Tree findMax
O(lgn)
2-3 Tree buildTree
O(nlgn)
implementation of k-heap
array-based
k-heap insert
O(lgn)
k-heap general delete
O(n)
k-heap general search
O(n)
min k-heap deleteMax
O(n)
min k-heap deleteMin
O(lgn)
max k-heap deleteMax
O(lgn)
max k-heap deleteMin
O(n)
k-heap top-down build
O(nlgn)
k-heap bottom-up build
O(n)
k-heap frequent insertions
want larger k
k-heap frequent deletions
want smaller k
dual-heap insert
O(lgn)
dual-heap deleteMin
O(lgn)
dual-heap deleteMax
O(lgn)
dual-heap findMin
O(1)
dual-heap findMax
O(1)
dual-heap buildHeap
O(n)
implementation of minmax/maxmin heap
sequential array-based with root at A[1]