Difference between revisions of "Template:List data structure comparison"

From blackwiki
Jump to navigation Jump to search
imported>Salamurai
(<noinclude>{{Template reference list}}</noinclude>)
imported>Dcoetzee
(Reference for linear space wasted by dynamic array)
Line 30: Line 30:
 
|style="background:#ffdddd"|Θ(''n'')
 
|style="background:#ffdddd"|Θ(''n'')
 
|style="background:#ddffdd"|0
 
|style="background:#ddffdd"|0
|style="background:#ffdddd"|Θ(''n'')
+
|style="background:#ffdddd"|Θ(''n'')<ref name="brodnik">{{Citation | title=Resizable Arrays in Optimal Time and Space | date=Technical Report CS-99-09 | url=http://www.cs.uwaterloo.ca/research/tr/1999/09/CS-99-09.pdf | year=1999 | first1=Andrej | last1=Brodnik | first2=Svante | last2=Carlsson | first5=ED | last5=Demaine | first4=JI | last4=Munro | first3=Robert | last3=Sedgewick | author3-link=Robert Sedgewick (computer scientist) | publisher=Department of Computer Science, University of Waterloo}}</ref>
 
|style="background:#ffdddd"|Θ(''n'')
 
|style="background:#ffdddd"|Θ(''n'')
 
|}
 
|}
 
</div>
 
</div>
 
<noinclude>{{Template reference list}}</noinclude>
 
<noinclude>{{Template reference list}}</noinclude>

Revision as of 01:45, 20 June 2011

  Linked list Array Dynamic
array
Balanced
tree
Indexing Θ(n) Θ(1) Θ(1) Θ(log n)
Insertion/deletion at beginning Θ(1) N/A Θ(n) Θ(log n)
Insertion/deletion at end Θ(1) N/A Θ(1) amortized Θ(log n)
Insertion/deletion in middle search time +
Θ(1)[1]
N/A Θ(n) Θ(log n)
Wasted space (average) Θ(n) 0 Θ(n)[2] Θ(n)

References

  1. Gerald Kruse. CS 240 Lecture Notes: Linked Lists Plus: Complexity Trade-offs. Juniata College. Spring 2008.
  2. Brodnik, Andrej; Carlsson, Svante; Sedgewick, Robert; Munro, JI; Demaine, ED (Technical Report CS-99-09), Resizable Arrays in Optimal Time and Space (PDF), Department of Computer Science, University of Waterloo Check date values in: |date=, |year= / |date= mismatch (help)