AVL Red-black Search trees avg. O(log N), worst O(N) B-tree DAG insert(x, p) while inngrad = 0; print; process edges Priority heap Toplogicial sort deleteMin() O(V E) med Queue Complete binary tree Unidirected node-node paths Svakt CC Bidirected node-node paths Sterkt CC Impl. som array Node >= parent Tree Graf Binary heap Array single-source SPF for DAG idx*2 left, idx*2+1 right, idx/2 parent up/down insert/delete Dijkstra percolate O(|E| + V log V) O(log N) MST Prim heap property: If A is a parent node of B then the key of node A is ordered with respect to the key of node B with the same ordering applying across the heap. Either the keys of parent nodes are always greater than or equal to those of the children and the highest key is in the root node (this kind of heap is called max heap) or the keys of parent nodes are less than or equal to those of the children and the lowest key is in the root node (min heap) MST Kruskal O(|E| log |V|) shift[needle[i]] = len - i - 1 bad-suffix-shift O(1) lookup, O(kn) space, k=alphabet O(n) lookup/space Hvis nål[i − 1] er en mismatch og nål inneholder en annen kopi av nål[i..n] som ikke har tegnet nål[i − 1] som prefiks, flytt nål slik at kopien matcher substrengen som allerede var matchet av nål[i..n] log_M(N) height Data structures Boyer-Moore Strings Hash Åpen List on duplicate Lukket Next on duplicate Utvidbar good-suffix-shift Sorting fiskekake/ke = 4. _ = 1 Qsort Diskblokker, 2 nivå Median-of-three In the long term, the total time taken for adding m items to the array is O(m), and so the amortised time (i.e. time per insertion) is O(1 flytt nål minst mulig slik at et suffiks av t matcher et prefiks av nål log(100) = 7 bits needed An algorithm is O(log N) if it takes constant time, O(1), to cut the problem size by a fraction. Rec path from root; 0 left, 1 right; char in leaves Trie program Prefix code; unambigious 1. Merge single-trees/w lowest weight Compression Algo 2. Merge any trees with lowest weight: repeat algorithm Huffman finiteness, definiteness, input, output, effectiveness. computational method: algorithm - finiteness. O(C log C) with priqueue; O(C^2) when list-impl. Two-pass/offline algo due to frequency count an expression of a computational method written in a computer language Euclid GCD online balance self-adjusting O((12 ln(2/pi^2)) ln(n)) input in sequential fashion. iteratively compute answer, e.g. smallest sum so-far. no node allowed to be get deep, avl: heigh diff at most 1. restructering rule after every insert/delete