Algorithm Analysis Of Dynamic Table

1280 Words6 Pages

Algorithm Analysis and Design Analysis Report on DYNAMIC TABLES By Nageen Saleem Roll Num 102-BsCS-12 Section C Elucidation of Dynamic tables Dynamic Table basically is a form of tables used in databases with the attribute of column and rows. However, the term Dynamic tells us that a constant activity is being held in the table. This activity is actually reducing the overloading and memory of the table with an average search time and sorts out the complete table dynamically. Moreover Dynamic tables allow an item to be added or removed by adding or removing slots without letting the whole table affected. Why Dynamic Tables Hash Tables serve as good form of tables, but the problem with them is they are not flexible enough to add …show more content…

This can be referred to as contraction of table and is down with the perspective of keeping the load factor below the dynamic table constant fraction and above the amortized cost. When during insertion we used to double the size of table, we can half the size of table during deletion. However it will make the amortized cost above the desired value so there are different ways to improve the expansion and contraction simultaneously. So after an expansion, α(T) = ½ , thus at least half of the items in the table must be deleted before a contraction can occur. In the same way, after a contraction α(T) = ½ , thus the number of items in the table must be doubled by insertions before an expansion can …show more content…

In other words, create a new table of smaller size, and copy the data over. We need to reduce the table size when the size of our remaining data set shrinks too much. The rule for the insertion-only case was to double the table when it is full. We could simply reverse that rule, and copy our data to an array of half the current size, when it goes from just over half-full to exactly half-full. This would cost O(n)time, where n is the number of elements currently in the table. Unfortunately this is not a good idea. For instance, keep our rule where we double when a table is full. But divide the table size by 2 when the table drops to a quarter full, instead of half full. Thus the new array will be half full. This means that a linear number of inserts will have to happen for the table to double again. In fact the same holds for dividing again. This way, we get constant-time amortized

More about Algorithm Analysis Of Dynamic Table

Open Document