Advanced Data Structure and Algorithm Analysis (summer semester)

本文是高级数据结构与算法分析课程的复习笔记,涵盖了贪心算法、NP完全性问题和近似算法。贪心算法如活动选择问题,NP完全性涉及哈密顿回路问题和图灵机的决策问题,近似算法如背包问题的求解策略。还讨论了局部搜索、随机算法及其应用,并简单介绍了并行算法的类型和比较方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

高级数据结构与算法分析

本文是ADS期末复习所做整理包含课程重点内容,习题错题等


5-8 贪心算法 (Greedy Algorithm)

Make the best decision at each stage, under some greedy criterion

Key Points
  • Doesn’t guarantee an optimal solution, however, it’s quite like the heuristics method. (Woeks when the local optimum is the global optimal)
  • 跟Local Search的区别是Greedy Algorithm是在逐步地构建一个解,局部搜索是每次在局部去找更好的解(每次都是一个新的解)
Examples
  1. Activity Selection Problem

    • By GA: ends first first
      O(NlogN) O ( N l o g N )
    • By DP:

c1,j={ 1max{ c1,j1,c1,k(j)+1}if j=1if j>1(1) (1) c 1 , j = { 1 i f   j = 1 m a x { c 1 , j − 1 , c 1 , k ( j ) + 1 } i f   j > 1

​ If each activity has a weight:

c1,j={ 1max{ c1,j1,c1,k(j)+w
数据结构原本,大一统,外文书原版 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
### 回答1: data structure and algorithm analysis in c是一本C语言数据结构算法分析的经典教材,由Mark Allen Weiss编写。该书的主要特点是对数据结构和算法的讲解非常详细且透彻,采用了很多实例进行讲解,使得读者可以很快地掌握这些内容。此外,该书还特别强调了算法分析和设计的重要性,帮助读者理解复杂算法的实现方式,提高算法的优化能力。 而data structure and algorithm analysis in c的下载方式也非常简单,可以在网上找到相关的资源下载,并且也可以通过购买实体书的方式获得。对于想要深入学习C语言数据结构算法分析的人来说,这本书是非常值得推荐的一本入门教材。 ### 回答2: data structure and algorithm analysis in c是一本关于C语言数据结构算法分析的经典教科书。该书涵盖了广泛的数据结构和算法,包括数组、链表、树、图、排序、查找等。本书不仅涵盖了基本概念和技术,而且提供了深入的分析和高级应用。书中有丰富的例子和习题,方便读者深入理解和应用。该书是学习数据结构和算法的好材料,对于提高程序员的编程能力和解决问题的能力有很大的帮助。 ### 回答3: Data Structure and Algorithm Analysis in C是一本面向C++程序设计开发人员的算法和数据结构分析书籍。它涵盖了许多重要的算法和数据结构,如排序和搜索算法,二叉树,平衡树和图论等方面。本书旨在帮助读者深入了解算法和数据结构的基本知识,并提供了许多实用的示例和演练题来帮助读者巩固自己的知识。 本书包含了许多实际的示例和演练题,这些题目涵盖了从简单到复杂的各种情况,有助于读者更好地理解和应用所学知识。此同时,这本书也提供了大量的编码和调试技巧,帮助读者编写出高效和可维护的代码。 总之,Data Structure and Algorithm Analysis in C是一本优秀的参考书,无论你是刚接触算法和数据结构或是已经具备一定的基础,它都可以提供丰富的知识和实践经验。如果你正在寻找一本深入了解算法和数据结构的书籍,那么它一定是首选之一。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值