Embed presentation
Download to read offline







![Table Insert
TABLE-INSERT (T, x)
if size[T] = 0 then
allocate table[T] with 1 slot
size[T] 1
if num[T] = size[T] then
allocate new-table with 2.size[T] slots
copy all items in table[T] into new-table
free table[T]
table[T] new-table[T]
size[T] 2.size[T]
insert x into table[T]
num[T] num[T] + 1
end](https://image.slidesharecdn.com/dynamictable-200306074030/85/Dynamic-table-8-320.jpg)
![Potential Function
2
1
(T)if][
2
size[T]
2
1
(T)if][][2
)(
Tnum
TsizeTnum
T](https://image.slidesharecdn.com/dynamictable-200306074030/85/Dynamic-table-9-320.jpg)

Dynamic tables allow for the insertion and deletion of items in tables. When inserting an item, if the table is full, the table is made larger to accommodate more items. The load factor measures how full the table is and affects the cost of operations on the table. When the load factor drops below a certain level after deletions, the table may be made smaller to reclaim space.







![Table Insert
TABLE-INSERT (T, x)
if size[T] = 0 then
allocate table[T] with 1 slot
size[T] 1
if num[T] = size[T] then
allocate new-table with 2.size[T] slots
copy all items in table[T] into new-table
free table[T]
table[T] new-table[T]
size[T] 2.size[T]
insert x into table[T]
num[T] num[T] + 1
end](https://image.slidesharecdn.com/dynamictable-200306074030/85/Dynamic-table-8-320.jpg)
![Potential Function
2
1
(T)if][
2
size[T]
2
1
(T)if][][2
)(
Tnum
TsizeTnum
T](https://image.slidesharecdn.com/dynamictable-200306074030/85/Dynamic-table-9-320.jpg)
