Content deleted Content added
m Substing templates: {{Format ISBN}}. See User:AnomieBOT/docs/TemplateSubster for info. |
m v2.05b - Bot T5 CW#16 - Fix errors for CW project (Unicode control characters) |
||
Line 81:
| Unsorted [[linked list]]
| ''O''(1)
| ''O''(1)<ref name="listdelete">{{cite book |title=[[Introduction to Algorithms]] |publisher=The College of Information Sciences and Technology at Penn State|isbn=978-0-262-53091-0 |author=Thomas H. Cormen |author2=
| N/A
| ''O''(''n'')
Line 125:
| N/A
| ''O''(''n'')
| ''O''(1) for a ''min-heap''<br />''O''(''n'') for a ''max-heap''<ref name="heap">{{cite book |title=Introduction to Algorithms|publisher=The College of Information Sciences and Technology at Penn State|isbn=978-0-262-53091-0 |author=Thomas H. Cormen |author2=
| ''O''(1) for a ''max-heap''<br />''O''(''n'') for a ''min-heap''<ref name="heap" />
| ''O''(''n'')
Line 210:
|}
''Note'': Insert on an unsorted array is sometimes quoted as being ''O''(''n'') due to the assumption that the element to be inserted must be inserted at one particular ___location of the array, which would require shifting all the subsequent elements by one position. However, in a classic array, the array is used to store arbitrary unsorted elements, and hence the exact position of any given element is of no consequence, and insert is carried out by increasing the array size by 1 and storing the element at the end of the array, which is a ''O''(1) operation.<ref name="games">{{cite book|isbn=978-1-58450-663-8|title=Data Structures and Algorithms for Game Developers|author=Allen Sherrod|publisher=Cengage Learning|year=2007|quote=The insertion of an item into an unordered array does not depend on anything other than placing the new item at the end of the list. This gives the insertion into an unordered array of ''O''(1).}}</ref><ref>{{cite book |title=[[Introduction to Algorithms]]|publisher=The College of Information Sciences and Technology at Penn State|isbn=978-0-262-53091-0 |author=Thomas H. Cormen |author2=
This table is only an approximate summary; for each data structure there are special situations and variants that may lead to different costs. Also two or more data structures can be combined to obtain lower costs.
|