The.Algorithm.Design.Manual.Springer-Verlag.1998
The.Algorithm.Design.Manual.Springer-Verlag.1998 The.Algorithm.Design.Manual.Springer-Verlag.1998
Lecture 7 - elementary data structures LIST-DELETE(L, x) prev[x] = NIL if prev[x] NIL if next[x] NIL then next[prev[x]] = next[x] else head[L] = next[x] then prev[next[x]] = prev[x] Sentinels Boundary conditions can be eliminated using a sentinel element which doesn't go away. LIST-SEARCH'(L, k) x = next[nil[L]] while x NIL[L] and key[x] k file:///E|/LEC/LECTUR17/NODE7.HTM (8 of 13) [19/1/2003 1:34:42] do x = next[x]
Lecture 7 - elementary data structures LIST-INSERT'(L, x) LIST-DELETE'(L, x) Listen To Part 7-13 return x next[x] = next[nil[L]] prev[next[nil[L]]] = x next[nil[L]] = x prev[x] = NIL[L] next[prev[x]] next[x] next[prev[x]] = prev[x] Hash Tables Hash tables are a very practical way to maintain a dictionary. As with bucket sort, it assumes we know that the distribution of keys is fairly well-behaved. The idea is simply that looking an item up in an array is once you have its index. A hash function is a mathematical function which maps keys to integers. In bucket sort, our hash function mapped the key to a bucket based on the first letters of the key. ``Collisions'' were the set of keys mapped to the same bucket. file:///E|/LEC/LECTUR17/NODE7.HTM (9 of 13) [19/1/2003 1:34:42]
- Page 859 and 860: Lecture 2 - asymptotic notation Sup
- Page 861 and 862: Lecture 2 - asymptotic notation Nex
- Page 863 and 864: Lecture 3 - recurrence relations Is
- Page 865 and 866: Lecture 3 - recurrence relations
- Page 867 and 868: Lecture 3 - recurrence relations Li
- Page 869 and 870: Lecture 3 - recurrence relations Su
- Page 871 and 872: Lecture 3 - recurrence relations A
- Page 873 and 874: Lecture 4 - heapsort Note iteration
- Page 875 and 876: Lecture 4 - heapsort The convex hul
- Page 877 and 878: Lecture 4 - heapsort 1. All leaves
- Page 879 and 880: Lecture 4 - heapsort left = 2i righ
- Page 881 and 882: Lecture 4 - heapsort Since this sum
- Page 883 and 884: Lecture 4 - heapsort Selection sort
- Page 885 and 886: Lecture 4 - heapsort Greedy Algorit
- Page 887 and 888: Lecture 5 - quicksort Partitioning
- Page 889 and 890: Lecture 5 - quicksort Listen To Par
- Page 891 and 892: Lecture 5 - quicksort Listen To Par
- Page 893 and 894: Lecture 5 - quicksort The worst cas
- Page 895 and 896: Lecture 5 - quicksort Mon Jun 2 09:
- Page 897 and 898: Lecture 6 - linear sorting Since 2i
- Page 899 and 900: Lecture 6 - linear sorting With uni
- Page 901 and 902: Lecture 6 - linear sorting Listen T
- Page 903 and 904: Lecture 7 - elementary data structu
- Page 905 and 906: Lecture 7 - elementary data structu
- Page 907 and 908: Lecture 7 - elementary data structu
- Page 909: Lecture 7 - elementary data structu
- Page 913 and 914: Lecture 7 - elementary data structu
- Page 915 and 916: Lecture 7 - elementary data structu
- Page 917 and 918: Lecture 8 - binary trees - Joyce Ki
- Page 919 and 920: Lecture 8 - binary trees TREE-MINIM
- Page 921 and 922: Lecture 8 - binary trees Inorder-Tr
- Page 923 and 924: Lecture 8 - binary trees Listen To
- Page 925 and 926: Lecture 8 - binary trees insert(b)
- Page 927 and 928: Lecture 8 - binary trees Not (1) -
- Page 929 and 930: Lecture 9 - catch up Next: Lecture
- Page 931 and 932: Lecture 10 - tree restructuring 1.
- Page 933 and 934: Lecture 10 - tree restructuring Lis
- Page 935 and 936: Lecture 10 - tree restructuring Not
- Page 937 and 938: Lecture 10 - tree restructuring Cas
- Page 939 and 940: Lecture 11 - backtracking Next: Lec
- Page 941 and 942: Lecture 11 - backtracking Only 63 s
- Page 943 and 944: Lecture 11 - backtracking Recursion
- Page 945 and 946: Lecture 11 - backtracking Specifica
- Page 947 and 948: Lecture 12 - introduction to dynami
- Page 949 and 950: Lecture 12 - introduction to dynami
- Page 951 and 952: Lecture 12 - introduction to dynami
- Page 953 and 954: Lecture 12 - introduction to dynami
- Page 955 and 956: Lecture 12 - introduction to dynami
- Page 957 and 958: Lecture 13 - dynamic programming ap
- Page 959 and 960: Lecture 13 - dynamic programming ap
Lecture 7 - elementary data structures<br />
LIST-DELETE(L, x)<br />
prev[x] = NIL<br />
if prev[x] NIL<br />
if next[x] NIL<br />
then next[prev[x]] = next[x]<br />
else head[L] = next[x]<br />
then prev[next[x]] = prev[x]<br />
Sentinels<br />
Boundary conditions can be eliminated using a sentinel element which doesn't go away.<br />
LIST-SEARCH'(L, k)<br />
x = next[nil[L]]<br />
while x NIL[L] and key[x] k<br />
file:///E|/LEC/LECTUR17/NODE7.HTM (8 of 13) [19/1/2003 1:34:42]<br />
do x = next[x]