Have one to sell? Sell yours here
Algorithms, Data Structures, and Problem Solving With C++
 
See larger image
 
Tell the Publisher!
I'd like to read this book on Kindle

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.

Algorithms, Data Structures, and Problem Solving With C++ [Hardcover]

Mark Allen Weiss (Author)
3.2 out of 5 stars  See all reviews (4 customer reviews)


Available from these sellers.


Textbook Student FREE Two-Day Shipping for Students. Learn more

Formats

Amazon Price New from Used from
Hardcover --  

Book Description

0805316663 978-0805316667 June 1996 2
Experienced author and teacher Mark Allen Weiss now brings his expertise to the CS2 course with Algorithms, Data Structures, and Problem Solving with C++, which introduces both data structures and algorithm design from the viewpoint of abstract thinking and problem solving. The author chooses C++ as the language of implementation, but the emphasis of the book itself remains on uniformly accepted CS2 topics such as pointers, data structures, algorithm analysis, and increasingly complex programming projects.Algorithms, Data Structures, and Problem Solving with C++ is the first CS2 textbook that clearly separates the interface and implementation of data structures. The interface and running time of data structures are presented first, and students have the opportunity to use the data structures in a host of practical examples before being introduced to the implementations. This unique approach enhances the ability of students to think abstractly.Features * Retains an emphasis on data structures and algorithm design while using C++ as the language of implementation. * Reinforces abstraction by discussing interface and implementations of data structures in different parts of the book. * Incorporates case studies such as expression evaluation, cross-reference generation, and shortest path calculations. * Provides a complete discussion of time complexity and Big-Oh notation early in the text. * Gives the instructor flexibility in choosing an appropriate balance between practice, theory, and level of C++ detail. Contains optional advanced material in Part V. * Covers classes, templates, and inheritance as fundamental concepts in sophisticated C++ programs. * Contains fully functional code that has been tested on g++2.6.2, Sun 3.0.1, and Borland 4.5 compilers. Code is integrated into the book and also available by ftp. * Includes end-of-chapter glossaries, summaries of common errors, and a variety of exercises. 0805316663B04062001


Editorial Reviews

From the Inside Flap

This book was designed for a second course in computer science, which has typically been known as CS-2 Data Structures. The content of CS-2 has been evolving over some time, but there is general agreement that topics such as structures, pointers, and data structures should be taught, along with an introduction to algorithm analysis and a general scaling up of the complexity of programming projects.

Although the general topics of CS-2 are to some extent uniformly accepted, the language of expression has clearly not been and indeed invokes quite spirited debate among computer science educators. We use C++ in this text. C++ has a host of both benefits and disadvantages but is clearly gaining support as a prefered language in industry and academic circles.

My goal in writing this text is to provide a practical introduction to data structures and algorithms, from the viewpoint of abstract thinking and problem solving, as well as to the use of C++. I try to cover all important details concerning the data structures, the analyses, and their C++ implementations, and have stayed away from data structures that are theoretically interesting but not widely used. I have designed the textbook to allow flexibility in topic coverage for the instructor. It is impossible to cover all the C++ details, all the different data structures, and all the mathematics described in the text in a single course. The instructor will need to decide on an appropriate balance between practice, theory, and level of C++ detail.

Approach The most unique aspect of the text is the clear separation of the interface and implementation. In C++ the class mechanism allows the programmer to write the interface and implementation separately, to place them in separate files and compile separately, and to hide implementation details. In this textbook we take this a step further: The interface and implementation are discussed in separate parts of the book. Parts I, II, and III lay the groundwork, discussing basic concepts and tools and providing some practical examples, but implementation of the basic data structures are not shown until Part IV. This is the first CS-2 textbook to take this approach.

The separation of interface and implementation provides several benefits. Generally, it promotes abstract thinking: Class interfaces are written and used before the implementation is known, and it forces the reader to think about the functionality and potential efficiency of the various data structures. For example, programs that use a hash table are written hundreds of pages before the hash table is implemented. The proposed standard template library (STL) for C++ (which is likely to be mimicked in Ada and other languages) provides classes for stacks, queues, and almost all the fundamental data structures. We believe it will hasten the shift in emphasis of data structures courses from implemention to use.

Prerequisites The prerequisite is a working knowledge of small C or a C-like subset of C++, including basic data types, operators, control structures, functions, and input and output. Appendix A contains a review of this material. Students that have had a first course using C++ should be able to start at Chapter 1. Students that have had a first course using C should scan Appendix A to see the differences between C and C++. Students whose first course was neither C nor C++ will need to read Appendix A carefully. In any event, this textbook is not about C++; it is about data structures and algorithm design, which is the proper focus of a CS-2 course. Readers who are not fluent C++ programmers should have a C++ reference book available; some recommendations are listed in Chapter 1.

Discrete math is not a prerequisite. Mathematical proofs are relatively rare (except towards the end of the text), and when done they are usually preceded by a brief math review. However, establishing some of our claims requires proof; Chapters 7 and 18 through 23 require some degree of mathematical sophistication. The instructor may elect to skip mathematical aspects of the proofs by presenting only the results. All proofs in the text are clearly marked and are separate from the body of the text.

C++ Using C++ presents both advantages and disadvantages. The C++ class allows the separation of interface and implementation, as well as the hiding of internal details of the implementation. It cleanly supports the notion of abstraction. However, other languages support this also, notably Turbo Pascal and Ada. The advantage of C++ is that it is widely used in industry. Students perceive that the material they are learning is practical and will help them find employment, which provides motivation to persevere through the course. The disadvantage of C++ is that it is far from a perfect language pedagogically, especially in a second course, and thus additional care needs to be expended to avoid bad programming practices. A second disadvantage is that C++ is still not a stable language, so the various compilers behave differently.

It might have been preferable to write the book in a language-independent fashion, concentrating only on general principles such as the theory of the data structures and referring to C++ code only in passing, but that is impossible. C++ code is complex, and readers will need to see complete examples to understand some of the finer points. As mentioned earlier, a brief review of the simpler parts of C++ is provided in Appendix A. Part I of the book describes some of C++'s more advanced features relevant to data structures.

Three parts of the language stand out as requiring special pedagogical consideration: templates, inheritance, and exceptions. The approach to this material is as follows:

Templates: Templates are used extensively. Some readers may have reservations with this approach because it complicates the code, but I have included them because they are fundamental concepts in any sophisticated C++ program.

Inheritance: Inheritance is used relatively sparingly because it adds complications, and data structures are not a strong application area for it. The main instance in which it is used is to derive implementations of data structures from abstract specifications.

Exceptions: At the time of this writing, development of exceptions is several years behind that of templates. They are not universally implemented, and the exact semantics have yet to be standardized. Eventually they will be standardized, they will work, and they will be widely used. In recognition of this, my preference would have been to include them, but except for the handling of memory exhaustion, this is not possible right now. Consequently, exceptions are not otherwise used in the code. However, throughout the text we use the function EXCEPTION, described in Appendix D, to signal points at which an exception could be used. Appendix D also describes how to incorporate exceptions into the code should they be available on your compiler.

Text Organization This text introduces C++ and object-oriented programming (particularly abstraction) in Part I. We discuss pointers, arrays, and some other C++ topics and then go on to discuss the syntax and use of classes, templates, and inheritance.

Part II discusses Big-Oh and algorithmic paradigms, including recursion and randomization. Sorting is covered in a full chapter, and basic data structures are described in another chapter. The interfaces and running times of the data structures are presented without giving the implementations. The instructor then may take several approaches to present the remaining material. Two of these are:

Use the corresponding implementations in Part IV as each data structure is described. The instructor can ask students to extend the classes in various ways, as suggested in the exercises.

Show how the interface is used and cover implementation at a later point in the course. The case studies in Part III can be used to support this approach. Since complete implementations will be available on the internet, the instructor can provide a library of classes for use in programming projects. Details on using this approach are given below.

Part V describes advanced data structures such as splay trees, pairing heaps, and the disjoint set data structure that can be covered if time permits.

Chapter-by-Chapter Text Organization Part I consists of four chapters describing some advanced features of C++ that are used throughout the text. Chapter 1 describes pointers, arrays, and structures and also contains a short study that describes how a profiling tool is used to measure the running time of a program. Chapter 2 begins the discussion of object-oriented programming by describing the class mechanism in C++. Chapter 3 continues this discussion by examining templates, and Chapter 4 illustrates the use of inheritance. Several components, including strings and vectors, are written in these chapters.

Part II is about the basic algorithms and building blocks. In Chapter 5 a complete discussion of time complexity and Big-Oh notation is provided. Binary search is discussed and analyzed here. Chapter 6 is a crucial chapter that discusses the interface to the data structures and argues intuitively what the running time of the supported operations should be for each data structure. However, implementation of these data structures is not provided until Part IV. Chapter 7 describes recursion by first introducing the notion of proof by induction. This chapter also discusses divide-and-conquer, dynamic programming, and backtracking. One section describes several recursive numerical algorithms that are used to implement the RSA cryptosystem. Chapter 8 describes, codes, and analyzes several basic sorting algorithms, including the insertion sort, Shellsort, mergesort, and quicksort, as well as indirect sorting. It also proves the classic lower bound for sorting and discusses the related problems of selection. Finally, Chapter 9 is a short chapter that discusses random numbers, including their generation and use in randomized algorithms.

Part III provides several case studies, and each chapter is organized along a general theme. Chapter 10 illustrates several important techniques by examining games. Chapter 11 discusses the use of stacks in computer languages by examining an algorithm to check for balanced symbols and the classic operator precedence parsing algorithm. Complete implementations with code are provided for both algorithms. Chapter 12 discusses the basic utilities of file compression and cross-reference generation, and a complete implementation of the cross-reference generator is provided. Chapter 13 broadly examines simulation by looking at one problem that can be viewed as a simulation and then the more classic event-driven simulation. Finally, Chapter 14 illustrates how data structures are used to implement several shortest path algorithms efficiently for graphs.

The data structure implementations that correspond to the interfaces in Chapter 6 are presented in Part IV. Some mathematics is used in this part, especially in Chapters 18 to 20, and can be skipped at the discretion of the instructor. Chapter 15 provides implementations for both stacks and queues. First these data structures are implemented using a dynamic array; then they are implemented using linked lists. In Chapter 16 general linked lists are described. Extensions such as doubly linked lists, circular linked lists, and cursor implementations are left as exercises. Chapter 17 describes trees and illustrates the basic traversal schemes. Chapter 18 is a detailed chapter that provides several implementations of binary search trees. Initially, the basic binary search tree is shown, and then a binary search tree that supports order statistics is derived. AVL trees are discussed but not implemented; however, the more practical red black trees and AA-trees are implemented. Finally, the B-tree is examined. Chapter 19 discusses hash tables, and the quadratic probing scheme is implementated after examination of a simpler alternative. In Chapter 20 we describe the binary heap and examine heapsort and external sorting.

Part V contains material that is suitable for use in a more advanced course or for general reference. The algorithms are accessible even at the first-year level; however, for completeness we have included sophisticated mathematical analyses that are almost certainly beyond the reach of a first-year student. Chapter 21 describes the splay tree, which is a binary search tree that seems to perform extremely well in practice and is also competitive with the binary heap in some applications that require priority queues. Chapter 22 describes priority queues that support merging operations and provides an implementation of the pairing heap. Finally, Chapter 23 examines the classic disjoint set data structure.

Course Organization Ignoring factors such as the balance between theory and practice, the crucial issue in teaching the course is deciding how the materials in Parts II to IV are to be used. The material in Part I should be covered in depth, and the student should write one or two programs that illustrate the design, implementation, and testing of classes and template classes, and depending on how much C++ is desired to be taught, inheritance. Next, Chapter 5 discusses Big-Oh, and an exercise in which the student writes a short program and compares the running time with an analysis can be given to test comprehension.

In the separation approach, the key concept of Chapter 6 is simply the fact that different data structures support different access schemes with different efficiency. Students can be asked first to write an inefficient data structure. Any case study (except the tic-tac-toe example that uses recursion) can be used to test their programs, and the students can compare their inefficient data structures with an efficient library routine (provided by anonymous ftp, as discussed below). In this scheme all the case studies (except tic-tac-toe) can be examined to see how each of the particular data structures is used. In this way we see the interface for each data structure, and we see how it is used, but we do not see how it is efficiently implemented. This is truly a separation, and viewing things this way will greatly enhance the ability of students to think abstractly. Students can be asked to extend the case study but, once again, do not have to know any of the details of the data structures.

The implementation of the data structures can be discussed afterward, and recursion can be introduced whenever the instructor feels it is appropriate (but prior to binary search trees). The details of sorting can be discussed at any point after recursion. At this point the course can continue by using the same case studies and experimenting with modifications to the implementations of the data structures. For instance, the student can experiment with various forms of balanced binary search trees.

Instructors opting for a more traditional approach can simply discuss a case study in Part III after discussing a data structure implementation in Part IV. The book chapters are meant to be as independent of each other as possible.

Exercises Exercises come in various flavors. The basic In Short exercise asks a simple question or requires hand-drawn simulations of an algorithm described in the text. The In Theory section asks questions that either require mathematical analysis or perhaps ask for theoretically interesting solutions to problems. The In Practice section contains simple programming questions, including questions about syntax or particularly tricky lines of code. The Programming Projects section contains ideas for extended assignments.

Pedagogical Features The code in the text is fully functional and has been tested on the following compilers: g++ 2.6.2, Sun 3.0.1, and Borland 4.5. The code is available by anonymous ftp, as discussed below. This code will be updated as the language evolves, and a version that uses exceptions is provided. Margin notes are used to highlight important topics. At the end of each chapter, a list of common errors is provided in the Common Errors section. The Objects of the Game section lists important terms along with definitions and page references. References for further reading are provided at the end of most chapters.

Supplements

Code Availability: The exact location of this material may change. The example program code in the book is available via anonymous ftp at ftp.aw.com.

Instructor's Resource Guide: A guide that illustrates several approaches to the material is available to instructors on a disk. These approaches vary from a strong focus on theory to an emphasis on C++, to a more balanced approach. Each approach is outlined with sample test questions, sample assignments, and sample syllabi. Answers to select exercises are also provided. For more information on this disk, please contactyour sales rep.

Acknowledgements

Many, many people have helped me in the preparation of this book. First, I would like to thank all the folks at Addison-Wesley. My editor Carter Shanklin helped me refine my thinking and his assistant Christine Kulke kept everything flowing smoothly. Craig Johnson, Production Technology Supervisor, was especially helpful with my Frame questions. I would especially like to thank the people involved in the production of the text: Barbara Conway did a wonderful job of copyediting the manuscript and suggesting improvements throughout; Teri Holden was a fantastic production editor; Holly McLean-Aldis did a great job proofreading; and Lisa Jahred wrote the templates for the book design.

Some of the material in this text is adapted from my textbook Efficient C Programming: A Practical Approach (Prentice-Hall, 1995) and is used with per-mission of the publisher. I have attempted to place end-of-chapter references where appropriate.

I would like to thank the reviewers, who provided valuable comments, many of which have been incoprorated into the text:

Owen Astrachan Duke University Joe Faletti University of California, San Diego K. M. George Oklahoma State University Jim Heliotis Rochester Institute of Technology Jim Levenick Willamette University George Novacky University of Pittsburgh John Russo Indiana University Laurie White Armstrong State College of Georgia Edward Wright Western Oregon State University Alan Zaring Ohio Weslyan University

As usual, I had help from my friends at FIU. Thanks to Diane Kelly for handling all my other work and leaving me with enough time to work on the text. I would also like to thank Catherine Hernandez, Steve Luis, and Cory Tsang for their help installing Frame and keeping the printers up and running.

Most of all, I thank Becky, whom I love more than she can imagine, for her support during my book writing, especially in the last year.

From the Back Cover

Algorithms, Data Structures, and Problem Solving with C++ is the first CS2 textbook that clearly separates the interface and implementation of data structures. The interface and running time of data structures are presented first, and students have the opportunity to use the data structures in a host of practical examples before being introduced to the implementations. This unique approach enhances the ability of students to think abstractly.

Features

Retains an emphasis on data structures and algorithm design while using C++ as the language of implementation.

Reinforces abstraction by discussing interface and implementations of data structures in different parts of the book.

Incorporates case studies such as expression evaluation, cross-reference generation, and shortest path calculations.

Provides a complete discussion of time complexity and Big-Oh notation early in the text.

Gives the instructor flexibility in choosing an appropriate balance between practice, theory, and level of C++ detail. Contains optional advanced material in Part V.

Covers classes, templates, and inheritance as fundamental concepts in sophisticated C++ programs.

Contains fully functional code that has been tested on g++2.6.2, Sun 3.0.1, and Borland 4.5 compilers. Code is integrated into the book and also available by ftp.

Includes end-of-chapter glossaries, summaries of common errors, and a variety of exercises.


Product Details

  • Hardcover: 820 pages
  • Publisher: Addison-Wesley; 2 edition (June 1996)
  • Language: English
  • ISBN-10: 0805316663
  • ISBN-13: 978-0805316667
  • Product Dimensions: 9.3 x 7.6 x 1.5 inches
  • Shipping Weight: 3.2 pounds
  • Average Customer Review: 3.2 out of 5 stars  See all reviews (4 customer reviews)
  • Amazon Best Sellers Rank: #701,899 in Books (See Top 100 in Books)

More About the Author

Discover books, learn about writers, read author blogs, and more.

 

Customer Reviews

4 Reviews
5 star:
 (1)
4 star:
 (1)
3 star:
 (1)
2 star:    (0)
1 star:
 (1)
 
 
 
 
 
Average Customer Review
3.2 out of 5 stars (4 customer reviews)
 
 
 
 
Share your thoughts with other customers:
Most Helpful Customer Reviews

16 of 16 people found the following review helpful:
4.0 out of 5 stars Good, but needs improvement, January 1, 1998
By A Customer
This review is from: Algorithms, Data Structures, and Problem Solving With C++ (Hardcover)
I just finished a semester at the University of Texas at Austin in which this book was the text book for an abstract data types class. The book is a good textbook, but not a good desk reference.

The book is obviously written with students in mind, using rhetorical questions, leaving vital areas unexplained as "exercises for the reader", etc. As an introductory text, in an introductory class, the book served its purpose, though the professor was required to explain some of the details that the book lacked. The code that is included in the book is all written in pseudo-code, most of it does not compile without some tweaking, and when a student is trying to grasp a diffucult concept in graph theory, the last thing that student wants is to have to trace through the program, line-by-line, to catch some error that is irrelevant to the larger problem, such as semicolons that have been left out, unmatched parenthesis, variable names that are not allowed by most of the commercial compilers.

The book does have a good learning curve, however, and makes for good reading when first approaching a new computer science concept; however, when having to program a particularly hard section of a certain data structure, wading through pages of diatribe against older methods is not what is needed at that time.

For instance, after spending a large portion of an entire chapter on AVL trees, Weiss proceeds to give example code (that doesn't compile on Borland 5.0, Visual C++, or GNU compilers without some tweaking), but leaves out a crucial method! When first learning about AVL trees, one of the lessons that was drilled into our heads was the diffuculty of AVL deletion... yet the book summed it up in *one* sentence: "As with most data structures, deletion is the hardest task; it is left as an exercise to the reader."

Argh.

Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


7 of 7 people found the following review helpful:
1.0 out of 5 stars Thorough, but NOT for people new to advanced data structures, July 26, 1999
By A Customer
This review is from: Algorithms, Data Structures, and Problem Solving With C++ (Hardcover)
This book is very thorough, but thats really all I can tell you about it's content, because the material (both the algorithm analysis and the data structures material), is presented in such a way as that the author expects you to already have a basic understanding of these concepts. Worst yet, the author's code is extremely poorly documented. Stay away from this book if you are new to advanced data types or algorithm analysis.
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


2 of 2 people found the following review helpful:
3.0 out of 5 stars Many details missing or left unexplained., September 20, 1999
By A Customer
This review is from: Algorithms, Data Structures, and Problem Solving With C++ (Hardcover)
Tries to cover all topics but leaves many details that are needed by a beginner. Examples of code are difficult to comprehend.
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No

Share your thoughts with other customers: Create your own review
 
 
 
Most Recent Customer Reviews


Only search this product's reviews




Tags Customers Associate with This Product

 (What's this?)
Click on a tag to find related items, discussions, and people.
 
(1)

Your tags: Add your first tag
 

Sell a Digital Version of This Book in the Kindle Store

If you are a publisher or author and hold the digital rights to a book, you can sell a digital version of it in our Kindle Store. Learn more

Customer Discussions

This product's forum
Discussion Replies Latest Post
No discussions yet

Ask questions, Share opinions, Gain insight
Start a new discussion
Topic:
First post:
Prompts for sign-in
 


Active discussions in related forums
Search Customer Discussions
Search all Amazon discussions
   
Related forums



So You'd Like to...



Look for Similar Items by Category


Look for Similar Items by Subject