Data Structures and Algorithm Analysis in C, Second Edition(《数据结构与算法分析》C语言版 第二版)——Mark Allen Weiss

         Data Structures and Algorithm Analysis in C, SecondEdition


by Mark Allen Weiss

作者: Mark Allen Weiss






第一章: 简介


第二章:  算法分析


第三章: 列表,栈,和队列


第四章: 树


第五章: 哈希表


第六章: 优先队列(哈希表)


第七章: 排序


第八章: 互斥集合,抽象数据类型


第九章: 图算法


第十章: 算法设计技术


第十一章: 分摊分析












   This book describes data structures, methodsof organizing large amounts of data, and algorithm analysis, the estimation ofthe running time of algorithms. As computers become faster and faster, the needfor programs that can handle large amounts of input becomes more acute.Paradoxically, this requires more careful attention to efficiency, sinceinefficiencies in programs become most obvious when input sizes are large. Byanalyzing an algorithm before it is actually coded, students can decide if aparticular solution will be feasible. For example, in this text students lookat specific problems and see how careful implementations can reduce the timeconstraint for large amounts of data from 16 years to less than a second.Therefore, no algorithm or data structure is presented without an explanationof its running time. In some cases, minute details that affect the running time of the implementation are explored.


   Once a solution methodis determined, a program must still be written. As computers have become more powerful, the problems they solve have becomelarger and more complex, thus requiring development of more intricate programsto solve the problems. The goal of this text is to teach students goodprogramming and algorithm analysis skills simultaneously so that they candevelop such programs with the maximum amount of Efficiency.


   This book is suitable for either an advanceddata structures (CS7) course or a first-year graduate course in algorithmanalysis. Students should have some knowledge of intermediate programming,including such topics as pointers and recursion, and some background indiscrete math.






   I believe it isimportant for students to learn how to program for themselves, not how to copyprograms from a book. On the other hand, it is virtually impossible to discussrealistic programming issues without including sample code. For this reason,the book usually provides about half to three-quarters of an implementation,and the student is encouraged to supply the rest.


   The algorithms in thisbook are presented in ANSI C, which, despite some flaws, is arguably the mostpopular systems programming language. The use of C instead of Pascal allows theuse of dynamically allocated arrays (see for instance rehashing in Ch. 5). Italso produces simplified code in several places, usually because the and(&&) operation is shortcircuited.

    本书是用ANSI C描述的,尽管C语言有些不足,但是它大概是最流行的系统性的编程语言。使用C语言而不是使用Pascal语言,是因为C语言允许动态分配数组(可以在第五章中的重建内部数据结构部分找示例)。它也在几个地方提供了简化了的代码,通常是因为&&操作是短路(计算逻辑表达式中的一部分便能确定结果,而不对整个表达式进行计算的现象)的。

Most criticisms of Ccenter on the fact that it is easy to write code that is barely readable. Some of the more standard tricks, such as thesimultaneous assignment and testing against 0 via  if (x=y) are generally not used in the text, since the loss of clarity iscompensated by only a few keystrokes and no increased speed. I believe that this bookdemonstrates that unreadable code can be avoided by exercising reasonable care.





   Chapter 1 containsreview material on discrete math and recursion. I believe the only way to be comfortable with recursion is to see good uses overand over. Therefore, recursion is prevalent in this text, with examples inevery chapter except Chapter 5.


   Chapter 2 deals with algorithmanalysis. This chapter explains asymptotic analysis and its major weaknesses.Many examples are provided, including an in-depth explanation of logarithmicrunning time. Simple recursive programs are analyzed by intuitively convertingthem into iterative programs. More complicated divide and-conquer programs areintroduced, but some of the analysis (solving recurrence relations) isimplicitly delayed until Chapter 7, where it is performed in detail.


   Chapter 3 covers lists,stacks, and queues. The emphasis here is on coding these data structures usingADTS, fast implementation of these data structures, and an exposition of someof their uses. There are almost no programs (just routines), but the exercisescontain plenty of ideas for programming assignments.


   Chapter 4 covers trees,with an emphasis on search trees, including external search trees (B-trees).The UNIX file system and expression trees are used as examples. AVL trees andsplay trees are introduced but not analyzed. Seventy-five percent of the codeis written, leaving similar cases to be completed by the student. Additional coverage of trees, such as file compression andgame trees, is deferred until Chapter 10. Data structures for an externalmedium are considered as the final topic in several chapters.


   Chapter 5 is arelatively short chapter concerning hash tables. Some analysis is performed andextendible hashing is covered at the end of the chapter.


   Chapter 6 is aboutpriority queues. Binary heaps are covered, and there is additional material onsome of the theoretically interesting implementations of priority queues.


   Chapter 7 coverssorting. It is very specific with respect to coding details and analysis. All the important generalpurpose sorting algorithms are coveredand compared. Three algorithms are analyzed in detail: insertion sort,Shellsort, and quicksort. External sorting is covered at the end of thechapter.


   Chapter 8 discusses thedisjoint set algorithm with proof of the running time. This is a short andspecific chapter that can be skipped if Kruskal's algorithm is not discussed.


   Chapter 9 covers graphalgorithms. Algorithms on graphs are interesting not only because theyfrequently occur in practice but also because their running time is so heavilydependent on the proper use of data structures. Virtually all of the standardalgorithms are presented along with appropriate data structures, pseudocode,and analysis of running time. To place these problems in a proper context, ashort discussion on complexity theory (including NP-completeness andundecidability) is provided.


   Chapter 10 coversalgorithm design by examining common problem-solving techniques. This chapteris heavily fortified with examples. Pseudocode is used in these later chaptersso that the student's appreciation of an example algorithm is not obscured by implementationdetails.


   Chapter 11 deals withamortized analysis. Three data structures from Chapters 4 and 6 and theFibonacci heap, introduced in this chapter, are analyzed.


   Chapters 1-9 provideenough material for most one-semester data structures courses. If time permits,then Chapter 10 can be covered. A graduate course on algorithm analysis couldcover Chapters 7-11. The advanced data structures analyzed in Chapter 11 caneasily be referred to in the earlier chapters. The discussion of NP-completeness in Chapter 9 is far too brief to be used in such a course.Garey and Johnson's book on NP-completeness can be used to augment this text.





      Exercises, providedat the end of each chapter, match the order in which material is presented. Thelast exercises may address the chapter as a whole rather than a specificsection. Difficult exercises are marked with an asterisk, and more challengingexercises have two asterisks.


    A solutions manualcontaining solutions to almost all the exercises is available separately fromThe Benjamin/Cummings Publishing Company.





    References are placedat the end of each chapter. Generally the references either are historical,representing the original source of the material, or they represent extensionsand improvements to the results given in the text. Some references representsolutions to exercises.





     I would like to thankthe many people who helped me in the preparation of this and previous versionsof the book. The professionals at Benjamin/Cummings made my book a considerablyless harrowing experience than I had been led to expect. I'd like to thank myprevious editors, Alan Apt and John Thompson, as well as Carter Shanklin, whohas edited this version, and Carter's assistant, Vivian McDougal, for answeringall my questions and putting up with my delays. Gail Carrigan atBenjamin/Cummings and Melissa G. Madsen and Laura Snyder at PublicationServices did a wonderful job with production. The C version was handled by JoeHeathward and his outstanding staff, who were able to meet the productionschedule despite the delays caused by Hurricane Andrew.

    非常感谢那些在准备第一版和本版书的过程中帮助过我的人。Benjamin和Cummings的同行使我的书出版比我预期的要顺利得多。感谢上一版的编辑Alan Apt和John Thompson,还有Carter Shanklin ,其中Carter Shanklin编辑了这一版,还有Carter的助理,Vivian McDougal,回答了我所有的问题还忍受了我的延期。  在Benjamin/Cummings 的Gail Carrigan和Melissa G.Madsen 和出版服务部的Laura Snyder都为本书做了很大的贡献。C版本的数据结构是由Joe Heathward和他能够看到产品计划的优秀的职员负责的,尽管Hurricane Andrew造成了延期。

     I would like to thankthe reviewers, who provided valuable comments, many of which have beenincorporated into the text. Alphabetically, they are Vicki Allan (Utah StateUniversity), Henry Bauer (University of Wyoming), Alex Biliris (BostonUniversity), Jan Carroll (University of North Texas), Dan Hirschberg(University of California, Irvine), Julia Hodges (Mississippi StateUniversity), Bill Kraynek (Florida International University), Rayno D. Niemi(Rochester Institute of Technology), Robert O. Pettus (University of SouthCarolina), Robert Probasco (University of Idaho), Charles Williams (GeorgiaState University), and Chris Wilson (University of Oregon). I would particularlylike to thank Vicki Allan, who carefully read every draft and provided verydetailed suggestions for improvement.

    感谢审稿人,他们提供了非常有价值的注释,这些注释已经被收录到了文章当中。照字母顺序排列,他们是Vicki Allan,Henry Bauer,Alex Biliris,Jan Carroll.DanHirschberg,Julia Hodges,Bill Kraynek,Rayno D.Niemi,Robert O.Pettus,RobertProbasco,Charles Williams和Chris Wilson.特别感谢Vicki Allan,他认真地阅读了每一个手稿并且为本书的提高提供了非常详细的建议。

     At FIU, many peoplehelped with this project. Xinwei Cui and John Tso provided me with their classnotes. I'd like to thank Bill Kraynek, Wes Mackey, Jai Navlakha, and Wei Sunfor using drafts in their courses, and the many students who suffered throughthe sketchy early drafts. Maria Fiorenza, Eduardo Gonzalez, Ancin Peter, TimRiley, Jefre Riser, and Magaly Sotolongo reported several errors, and Mike Hallchecked through an early draft for programming errors. A special thanks goes toYuzheng Ding, who compiled and tested every program in the original book,including the conversion of pseudocode to Pascal. I'd be remiss to forgetCarlos Ibarra and Steve Luis, who kept the printers and the computer systemworking and sent out tapes on a minute's notice.

        在佛罗里达国际大学,许多人都给我提供了帮助。XinweiCui和John Tso给我提他们的课堂笔记。我想感谢BillKraynek,Wes Mackey,Jai Navlakha和Wei Sun,他们在他们的课堂上使用了我的手稿,使得许多学生试用了还算说得过去的初稿。MariaFiorenza, Eduardo Gonzalez, Ancin Peter, Tim Riley, Jefre Riser, 和 Magaly Sotolongo找出了几个错误,Mike Hall在初稿中找出了错误的程序。特别感谢Yuzheng Ding,他编译并测试了原版书中的每一个程序,包括伪代码到Pascal的转换。差点忘记了Carlos Ibarra 和Steve Luis,他们一刻不停地操作着打印机和电脑系统并且及时发放出磁带。

     This book is a product of a love for datastructures and algorithms that can be obtained only from top educators. I'dlike to take the time to thank Bob Hopkins, E. C. Horvath, and Rich Mendez, whotaught me at Cooper Union, and Bob Sedgewick, Ken Steiglitz, and Bob Tarjanfrom Princeton.

        这本书是对数据结构和算法的热爱的产物,这完全来自于教过我的老师们。我想感谢在库伯联盟学院教过我的Bob Hopkins, E. C. Horvath, 和Rich Mendez,以及在普林斯顿大学教过我的Bob Sedgewick, Ken Steiglitz, 和Bob Tarjan。

     Finally, I'd like tothank all my friends who provided encouragement during the project. Inparticular, I'd like to thank Michele Dorchak, Arvin Park, and Tim Snyder forlistening to my stories; Bill Kraynek, Alex Pelin, and Norman Pestaina forbeing civil next-door (office) neighbors, even when I wasn't; Lynn and Toby Berkfor shelter during Andrew, and the HTMC for work relief.

     最后,我要感谢在整个过程中给我鼓励的所有朋友们。尤其是要感谢倾听我的故事的Michele Dorchak, Arvin Park,和Tim Snyder,还有一直包容我的好同事们。还要感谢在Andrew期间Lynn和TobyBerk对我的帮助,以及HTMC对我的帮助。

     Any mistakes in thisbook are, of course, my own. I would appreciate reports of any errors you find;my e-mail address is





Miami , Florida


September 1992


已标记关键词 清除标记
©️2020 CSDN 皮肤主题: Age of Ai 设计师:meimeiellie 返回首页