Difference between revisions of "TADM2E 3.15"

From Algorithm Wiki
Jump to: navigation, search
(Recovering wiki)
 
(Recovering wiki)
Line 8: Line 8:
  
 
Search X:
 
Search X:
   return (A[X] < k) and (B[A[X]] == X)
+
   return (A[X] < k) and (B[A[X]] == X)
  
 
Delete X:  
 
Delete X:  

Revision as of 18:22, 11 September 2014

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[k] = A[X]; 
 B[A[X]] = B[k]; 
 k = k-1;