Module Sets { \\ Inventory as set of keys \\ keys has to be unique \\ Empty string "" can be used as key \\ Search, Add and Delete in O(1) \\ if we use delete we lost the order \\ keys can be numbers or strings, either can exist in same inventory \\ 0 can be used for string \\ Keys must be unique \\ a variable which hold an inventory is a pointer type Inventory A=10,20,40 If Exist(A,20) Then Print Eval(A)=20 k=Each(A) While k { \\ print keys as strings and value same as key (as number here) Print Eval$(k, k^), Eval(k) } \\ sort is a Quick sort Sort Descending A as number Print A ' 40 20 10 \\ For no unique keys \\ we can't delete from anywhere. \\ we can drop some keys from the end only \\ Exist() move internal index to last of the same key \\ we can give values also (make it as Map) Inventory Queue B=1,1,1,2,2,6,10 Drop B 3 Print B ' prints 1 1 1 2 \\ sort is an insertion sort (stable) } Sets