Unformatted text preview: Ω (n) time and each implementation of (b) needs Ω (n+m) time. The following array implementation would guarantee O(n) for (a), O(n+m) for (b) and O(1) for (c) (O(1) is the best we can get). The elements are stored in contiguous cells of an array element [1: maxlength ], the variable last points to the last element of the list ( element  is always the first element). ATD list can now be represented by the following C-like structure List = structure element : array[1:maxlength] of integers last: integer end  procedure NO3ONLY(L: List;); var n : integer; begin L.last := L.last – (L.last div 3); for (n:=1; n<(L.last+1)) do begin L.element[n] := L.element[n+((n-1) div 2)] end...
View Full Document
This note was uploaded on 12/10/2009 for the course CAS 2c03 taught by Professor Janicki during the Spring '03 term at McMaster University.
- Spring '03