TableInsert(T, x) 1 if size(T) = 0 2 then new table[T] with 1 slot 3 size[T] = 1 4 if num(T) = size(T) 5 then create new table with 2*size[T] slots ; 6 copy items from table[T] to new table 7 free table[T] 8 table[T] = new table 9 size[T] = 2*size[T] 10 insert x into table[T] 11 num[T] = num[T] + 1