Debugging By Thinking: A Multidisciplinary Approach

Chapter 5: Case Studies I

5.1 Case Study 1

5.1.1 The program

The purpose of the case studies in this book is to demonstrate the use of some of the concepts presented in the preceding chapters. The defects analyzed are the actual mistakes made by the author when developing this software. Different people are prone to make different mistakes. Focus on the method used in debugging, rather than the particular error in question.

The algorithms implemented in the case studies for this book were chosen based on the following criteria:

  • There is a published design in pseudocode for the algorithm accessible in the computer science literature.

  • The implementation should follow the original design relatively closely so that it is easy to compare it with the design.

  • The algorithm computes a useful result. Toy programs do not make interesting examples.

  • The algorithm has excellent computational complexity. Toy programs do not make convincing examples.

  • The algorithm is complicated enough that some bugs would likely occur in implementing it.

The program we debug in this section is a heap sort that works on linked list structures. Heap sorts are usually explained in an undergraduate course in data structures. The data-structure books we reviewed for this example present heap sorts of integer data stored in arrays. See Algorithms in C++ (3rd ed.) [Se98] for an excellent analysis of array-based heap sorts. This example presents a heap sort that works on linked lists, written in C++.

The data-structure books present array-based heap sorts because they can be coded...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Nesting Software
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.