[Arch] Java数据结构与算法 - 综述

博客首页 » Arch Java数据结构与算法 - 综述

发布于 18 Jul 2015 15:27
标签 blog
[structs-algrs-java]1-1-data-structs-overview-perf-1.png
[structs-algrs-java]1-1-data-structs-overview-perf-2.png Characteristics of Data Structures
Data Structure 名称 Advantages Disadvantages
Array 数组 Quick insertion, very fast access if index known. Slow search, slow deletion, fixed size.
Ordered array 有序数组 Quicker search than unsorted array. Slow insertion and deletion, fixed size.
Stack Provides last-in, first-out access. Slow access to other items.
Queue 队列 Provides first-in, first-out access. Slow access to other items.
Linked list 链表 Quick insertion, quick deletion. Slow search.
Binary tree 二叉树 Quick search, insertion, deletion (if tree remains balanced). Deletion algorithm is complex.
Red-black tree 红黑树 Quick search, insertion, deletion. Tree always balanced. Complex.
2-3-4 tree 234树 Quick search, insertion, deletion. Tree always balanced. Similar trees good for disk storage. Complex.
Hash table 哈希表 Very fast access if key known. Fast insertion. Slow deletion, access slow if key not known, inefficient memory usage.
Heap Fast insertion, deletion, access to largest item. Slow access to other items.
Graph Models real-world situations. Some algorithms are slow and complex.
名称 特点 缺点 大小
数组 知道下标存取快 快(若知下标) 快(若知下标) 固定
有序数组 比无序数组查找快 快(若知下标) 快(与数组比) 固定
后进先出
队列 先进先出
链表
二叉树 删除复杂 快(若树平衡)
红黑树 树总平衡 复杂
234树 树总平衡 复杂
哈希表 浪费空间 慢(为何?) 极快(需知key,若不知则慢) 极快(需知key,若不知则慢)
对大数据项存取快 大数据项快,其他慢 大数据项快,其他慢
建模 慢、复杂

本页面的文字允许在知识共享 署名-相同方式共享 3.0协议和GNU自由文档许可证下修改和再使用,仅有一个特殊要求,请用链接方式注明文章引用出处及作者。请协助维护作者合法权益。


系列文章

文章列表

  • Arch Java数据结构与算法 - 综述

这篇文章对你有帮助吗,投个票吧?

rating: 0+x

留下你的评论

Add a New Comment