掌握高级数据结构:平衡二叉树、可并优先队列与线段树详解

需积分: 11 15 下载量 149 浏览量 更新于2024-07-20 收藏 359KB PDF 举报
高级数据结构课程由刘汝佳主讲,涵盖了一系列关键的数据结构技术,包括平衡二叉树、可并优先队列、线段树和树状数组的基础以及RMQ与LCA。课程的核心内容首先从平衡二叉树开始,它是一种特殊的二叉搜索树,其中每个节点的左子树小于根节点,右子树大于根节点。基本的平衡二叉树如二叉查找树(BST)在查找、插入和删除操作中的时间复杂度为O(h),其中h表示树的高度。为了提高效率,平衡二叉树如AVL树引入了高度限制,即每个节点的左右子树高度差不超过1,这确保了树的高度大致上是O(logn),从而在各种操作中保持快速响应。 AVL树的维护通过旋转操作实现,单旋转用于解决某个子树高度过大导致不平衡的情况,例如当左孩子高度大于右孩子高度+1时,通过将右孩子作为旋转轴进行调整。双旋转则涉及更复杂的场景,当祖父节点和孙子节点共线或不共线时,通过先向左旋转再向右旋转来重新平衡树结构。在插入新元素时,会沿着路径找到第一个不平衡的祖父节点,然后进行相应的旋转。 接下来,课程介绍的是可并优先队列,这是一种特殊的队列,能够合并两个已排序的队列,同时保持高效查询最小元素的能力。线段树和树状数组是另一种高效的数据结构,它们分别用于处理区间查询和更新问题,常用于求解范围最大值、最小值等问题,其查询时间复杂度通常为O(logn)。 最后,课程涵盖了Range Minimum Query (RMQ)和Least Common Ancestor (LCA)的概念。RMQ用于在一个数组中查找一个区间的最小值,而LCA则是查找两个节点最近的公共祖先。这些高级数据结构在图论、动态规划等算法中起着关键作用,能够大大提高复杂问题的解决效率。 刘汝佳的高级数据结构课程深入浅出地讲解了这些数据结构的原理、实现和应用场景,对于提高算法设计和优化能力具有重要意义。学习者将不仅掌握基本的数据结构理论,还能学会如何在实际编程中灵活运用这些工具。
2017-10-14 上传
数据结构原本,大一统,外文书原版 Data structures Contents Articles Introduction 1 Data structure 1 Linked data structure 3 Succinct data structure 6 Implicit data structure 8 Compressed data structure 9 Search data structure 10 Persistent data structure 11 Concurrent data structure 18 Abstract data types 21 Abstract data type 21 List 29 Stack 32 Queue 61 Deque 63 Priority queue 66 Map 70 Bidirectional map 73 Multimap 74 Set 75 Tree 80 Arrays 85 Array data structure 85 Row-major order 91 Dope vector 93 Iliffe vector 94 Dynamic array 95 Hashed array tree 98 Gap buffer 99 Circular buffer 101 Sparse array 111 Bit array 112 Bitboard 117 Parallel array 121 Lookup table 123 Lists 129 Linked list 129 XOR linked list 145 Unrolled linked list 147 VList 149 Skip list 151 Self-organizing list 157 Binary trees 162 Binary tree 162 Binary search tree 170 Self-balancing binary search tree 180 Tree rotation 182 Weight-balanced tree 185 Threaded binary tree 186 AVL tree 191 Red-black tree 195 AA tree 210 Scapegoat tree 215 Splay tree 219 T-tree 234 Rope 237 Top Trees 242 Tango Trees 246 Van Emde Boas tree 268 Cartesian tree 272 Treap 277 B-trees 281 B-tree 281 B+ tree 292 Dancing tree 297 2-3 tree 298 2-3-4 tree 299 Queaps 301 Fusion tree 305 Bx-tree 309 Heaps 312 Heap 312 Binary heap 315 Binomial heap 321 Fibonacci heap 326 2-3 heap 331 Pairing heap 331 Beap 334 Leftist tree 335 Skew heap 338 Soft heap 341 d-ary heap 343 Tries 346 Trie 346 Radix tree 353 Suffix tree 358 Suffix array 363 Compressed suffix array 367 FM-index 368 Generalised suffix tree 371 B-trie 372 Judy array 372 Directed acyclic word graph 374 Multiway trees 376 Ternary search tree 376 And–or tree 379 (a,b)-tree 380 Link/cut tree 381 SPQR tree 381 Spaghetti stack 384 Disjoint-set data structure 385 Space-partitioning trees 389 Space partitioning 389 Binary space partitioning 390 Segment tree 395 Interval tree 399 Range tree 404 Bin 406 k-d tree 408 Implicit k-d tree 416 min/max kd-tree 419 Adaptive k-d tree 420 Quadtree 421 Octree 427 Linear octrees 429 Z-order 429 UB-tree 434 R-tree 435 R+ tree 441 R* tree 442 Hilbert R-tree 445 X-tree 452 Metric tree 452 vP-tree 453 BK-tree 454 Hashes 455 Hash table 455 Hash function 468 Open addressing 476 Lazy deletion 479 Linear probing 479 Quadratic probing 480 Double hashing 484 Cuckoo hashing 486 Coalesced hashing 491 Perfect hash function 494 Universal hashing 496 Linear hashing 501 Extendible hashing 502 2-choice hashing 508 Pearson hashing 508 Fowler–Noll–Vo hash function 509 Bitstate hashing 511 Bloom filter 512 Locality preserving hashing 523 Morton number 524 Zobrist hashing 529 Rolling hash 530 Hash list 531 Hash tree 532 Prefix hash tree 534 Hash trie 535 Hash array mapped trie 535 Distributed hash table 536 Consistent hashing 542 Stable hashing 544 Koorde 544 Graphs 547 Graph 547 Adjacency list 549 Adjacency matrix 551 And-inverter graph 554 Binary decision diagram 556 Binary moment diagram 560 Zero-suppressed decision diagram 562 Propositional directed acyclic graph 563 Graph-structured stack 564 Scene graph 565 Appendix 570 Big O notation 570 Amortized analysis 581 Locality of reference 582 Standard Template Library 585 References Article Sources and Contributors 596 Image Sources, Licenses and Contributors 605 Article Licenses License 610