Difference between revisions of "3.31"
Jump to navigation
Jump to search
(Created page with "Init: k=0 Insert X: k = k+1; A[X] = k; B[k] = X; Search X: return (A[X] < k) and (B[A[X]] == X) Delete X: A[B[k]] = A[X]; B[A[X]] = B[k]; k = k-1; Ple...") |
(Created page with "Init: k=0 Insert X: k = k+1; A[X] = k; B[k] = X; Search X: return (A[X] < k) and (B[A[X]] == X) Delete X: A[B[k]] = A[X]; B[A[X]] = B[k]; k = k-1; Ple...") |
(No difference)
|
Latest revision as of 18:08, 20 September 2020
Init:
k=0
Insert X:
k = k+1; A[X] = k; B[k] = X;
Search X:
return (A[X] < k) and (B[A[X]] == X)
Delete X:
A[B[k]] = A[X]; B[A[X]] = B[k]; k = k-1;
Please note that this data structure doesn't support inserting the same X more than once.
Back to Chapter 3