5
A
回答
0
0
這是維基百科:Worst-case analysis of data structures
+----------------------+----------+------------+----------+--------------+
| | Insert | Delete | Search | Space Usage |
+----------------------+----------+------------+----------+--------------+
| Unsorted array | O(1) | O(1) | O(n) | O(n) |
| Value-indexed array | O(1) | O(1) | O(1) | O(n) |
| Sorted array | O(n) | O(n) | O(log n) | O(n) |
| Unsorted linked list | O(1)* | O(1)* | O(n) | O(n) |
| Sorted linked list | O(n)* | O(1)* | O(n) | O(n) |
| Balanced binary tree | O(log n) | O(log n) | O(log n) | O(n) |
| Heap | O(log n) | O(log n)** | O(n) | O(n) |
| Hash table | O(1) | O(1) | O(1) | O(n) |
+----------------------+----------+------------+----------+--------------+
* The cost to add or delete an element into a known location in the list
(i.e. if you have an iterator to the location) is O(1).
If you don't know the location, then you need to traverse the list to the location of deletion/insertion, which takes O(n) time.
** The deletion cost is O(log n) for the minimum or maximum, O(n) for an arbitrary element.
相關問題
- 1. 時間數據結構的複雜性
- 2. 數據結構樹複雜
- 3. 複製數據結構和空間複雜性
- 4. MongoDB:構建複雜的數據結構
- 5. Rtti訪問複雜數據結構中的字段和屬性
- 6. Python數據結構的複雜性/性能檢查
- 7. Redis中的複雜數據結構
- 8. solr - 複雜的數據結構
- 9. numpy複雜的數據結構
- 10. Perl中複雜的數據結構
- 11. 隱藏複雜的微數據結構
- 12. Java中的複雜數據結構
- 13. 複雜的數據結構Redis
- 14. 根據Big-O表示法對不同數據結構進行不同操作的複雜性
- 15. 結構複雜
- 16. 數據結構之間的複雜性比較
- 17. 複雜定價結構的結構化數據佈局
- 18. FactoryGirl,Rspec和複雜的數據庫結構
- 19. MySQL:複雜的數據結構化和查詢
- 20. EF代理和複雜的數據結構
- 21. 遷移和備份模式(複雜的數據庫結構)
- 22. pycparser.plyparser.ParseError複雜結構
- 23. AutoMapping複雜結構
- 24. 不同的單位和數據結構
- 25. 排序複雜JSON對象而不損耗數據,並用相同的結構
- 26. 複雜的UI結構和骨幹js
- 27. 複雜性結合
- 28. 使用GraphQL結構來構建複雜的數據庫查詢
- 29. 在Python中構建「複雜」數據結構的最佳方式
- 30. Struts2的 - 從結構複雜
這正是我想避免。但誰知道它可能很有趣。不管怎麼說,還是要謝謝你。 – 2011-01-06 13:58:11