本书使用流行的C++语言作为描述语言,详细介绍了数据结构和算法。全书共分为五大部分。第一部分的C++教程是全书的基础,具体讲述C++的运行环境、数据类型和运算符、基本语法等;同时介绍了面向对象的一些概念。第二部分对C++的各种数据结构接口和其中涉及到的算法及算法分析进行了详细介绍,并用实例说明了如何使用这些数据结构。第三部分是这些数据结构的实际应用,第一章对不同应用的理论和具体实现做了详尽阐述。第四部分则针对各种数据结构接口、分别给予更加细致的实例解说。第五部分介绍了一些高级的数据结构。通过对本书的学习,读者能够抽象地思考不同数据结构的功能,了解它们之间的相关性,掌握在计算机工程中使用这些数据结构的能力。本书概念清楚,逻辑性强,内容新颖,可作为高等院校计算机软件专业与计算机应用专业学生的教材和参考用书,也可供计算机工程技术人员参考。
PartI:ObjectsandC++
Chapter1Arrays,Pointers,andStructures3
1.1WhatArePointers,Arrays,andStructures?3
1.2ArraysandStrings4
1.2.1First-ClassVersusSecond-ClassObjects4
1.2.2Usingthevector6
1.2.3Resizingavector7
1.2.4push_back:sizeandcapacity11
1.2.5Parameter-PassingMechanisms11
1.2.6PrimitiveArraysofConstants13
1.2.7MultidimensionalArrays14
1.2.8TheStandardLibrarystringType14
1.3PointerSyntaxinC++15
1.4DynamicMemoryManagement20
1.4.1ThenewOperator21
1.4.2GarbageCollectionanddelete21
1.4.3StalePointers,DoubleDeletion,andMore22
1.5ReferenceVariables24
1.6Structures26
1.6.1PointerstoStructures28
1.6.2ExogenousVersusIndigenousDataandShallowVersusDeep Copying29
1.6.3NoncontiguousLists:LinkedLists30
Summary32
ObjectsoftheGame32
CommonErrors34
OntheInternet35
Exercises35
References38
Chapter2 ObjectsandClasses41
2.1WhatIsObject-OrientedProgramming?41
2.2BasicclassSyntax43
2.2.1ClassMembers43
2.2.2ExtraConstructorSyntaxandAccessors45
2.2.3SeparationofInterfaceandImplementation48
2.2.4TheBigThree:Destructor,CopyConstructor,and operator=51
2.2.5DefaultConstructor57
2.3AdditionalC++ClassFeatures57
2.3.1InitializationVersusAssignmentintheConstructor Revisited61
2.3.2TypeConversions63
2.3.3OperatorOverloading64
2.3.4InputandOutputandFriends67
2.4SomeCommonIdioms68
2.4.1AvoidingFriends70
2.4.2StaticClassMembers71
2.4.3TheenumTrickforIntegerClassConstants71
2.5Exceptions72
2.6AstringClass73
2.7Recap:WhatGetsCalledandWhatAretheDefaults?82
2.8Composition84
Summary85
ObjectsoftheGame85
CommonErrors87
OntheIntemet89
Exercises90
References96
Chapter3 Templates97
Chapter4 Inheritance119
Chapter5 DesignPatterns155
PartII:AlgorithmsandBuildingBlocks
PartIII:Applications
PartIV:Implementations
Appendix A
Appendix B
Appendix C