Sahni provides several applications for each data structure and algorithm design method discussed, taking examples from topics such as bu, compression and coding, and image processing. To think algorithmically and get the spirit of how algorithms are designed. Recursion is more expensive than corresponding iterative solutions since bookkeeping is necessary. In each step reduce the range of the search space by half. Insert an unsorted card at the correct position aea the sorted part.
|Published (Last):||2 November 2015|
|PDF File Size:||14.10 Mb|
|ePub File Size:||18.73 Mb|
|Price:||Free* [*Free Regsitration Required]|
Often it is regarded as a central course of the curriculum. It is fascinating and instructive to trace the history of how the subject matter for this course has changed. Newell, C. Shaw, and H. Simon , LISP 1. Farber, R. Griswold, and I. Knuth appeared. His thesis was that list processing was not a magical thing that could only be accomplished within a specially designed system. Instead, he argued that the same techniques could be carried out in almost any language and he shifted the emphasis to efficient algorithm design.
The new strategy was to explicitly construct a representation such as linked lists within a set of consecutive storage locations and to describe the algorithms by using English plus assembly language. Progress in the study of data structures and algorithm design has continued. Out of this recent work has come many good ideas which we believe should be presented to students of computer science. It is our purpose in writing this book to emphasize those trends which we see as especially valuable and long lasting.
The most important of these new concepts is the need to distinguish between the specification of a data structure and its realization within an available programming language. This distinction has been mostly blurred in previous books where the primary emphasis has either been on a programming language or on representational techniques.
Our attempt here has been to separate out the specification of the data structure from its realization and to show how both of these processes can be successfully accomplished. The specification stage requires one to concentrate on describing the functioning of the data structure without concern for its implementation.
This can be done using English and mathematical notation, but here we introduce a programming notation called axioms. The resulting implementation independent specifications valuable in two ways: i to help prove that a program which uses this data structure is correct and ii to prove that a particular implementation of the data structure is correct.
To describe a data structure in a representation independent way one needs a syntax. This can be seen at the end of section 1. This book also seeks to teach the art of analyzing algorithms but not at the cost of undue mathematical sophistication. The value of an implementation ultimately relies on its resource utilization: time and space. This implies that the student needs to be capable of analyzing these factors. The data structures course comes at an opportune time in their training to advance and promote these ideas.
For every algorithm that is given here we supply a simple, yet rigorous worst case analysis of its behavior. The growth of data base systems has put a new requirement on data structures courses, namely to cover the organization of large files.
Also, many instructors like to treat sorting and searching because of the richness of its examples of data structures and its practical application. The choice of our later chapters reflects this growing interest. One especially important consideration is the choice of an algorithm description language. Such a choice is often complicated by the practical matters of student background and language availability.
Our decision was to use a syntax which is particularly close to ALGOL, but not to restrict ourselves to a specific language. This gives us the ability to write very readable programs but at the same time we are not tied to the idiosyncracies of a fixed language. Wherever it seemed advisable we interspersed English descriptions so as not to obscure the main pointof an algorithm.
For those who have only FORTRAN available, the algorithms are directly translatable by the rules given in the appendix and a translator can be obtained see appendix A. On the other hand, we have resisted the temptation to use language features which automatically provide sophisticated data structuring facilities.
We have done so on several grounds. One reason is the need to commit oneself to a syntax which makes the book especially hard to read by those as yet uninitiated. Even more importantly, these automatic featules cover up the implementation detail whose mastery remains a cornerstone of the course. The basic audience for this book is either the computer science major with at least one year of courses or a beginning graduate student with prior training in a field other than computer science.
The following are two scenarios which may help in deciding what chapters should be covered. He would cover chapters one through five skipping sections 2. Then, in whatever time was left chapter seven on sorting was covered. The second quarter starts with chapter seven which provides an excellent survey of the techniques which were covered in the previous quarter.
Then the material on external sorting, symbol tables and files is sufficient for the remaining time. Note that the material in chapter 2 is largely mathematical and can be skipped without harm.
The paradigm of class presentation that we have used is to begin each new topic with a problem, usually chosen from the computer science arena. Once defined, a high level design of its solution is made and each data structure is axiomatically specified. A tentative analysis is done to determine which operations are critical. The finishedalgorithm in the book is examined followed by an argument concerning its correctness.
Then an analysis is done by determining the relevant parameters and applying some straightforward rules to obtain the correct computing time formula.
In summary, as instructors we have tried to emphasize the following notions to our students: i the ability to define at a sufficiently high level of abstraction the data structures and algorithms that are needed; ii the ability to devise alternative implementations of a data structure; iii the ability to synthesize a correct algorithm; and iv the abilityto analyze the computing time of the resultant program.
In addition there are two underlying currents which, though not explicitly emphasized are covered throughout. The first is the notion of writing nicely structured programs.
For all of the programs contained herein we have tried our best to structure them appropriately. We hope that by reading programs with good style the students will pick up good writing habits. The second current is the choice of examples. We have tried to use those examples which prove a point well, have application to computer programming, and exhibit some of the brightest accomplishments in computer science.
At the close of each chapter there is a list of references and selected readings. These are not meant to be exhaustive. They are a subset of those books and papers that we found to be the most useful. Otherwise, they are either historically significant or develop the material in the text somewhat further. Many people have contributed their time and energy to improve this book.
For this we would like to thank them. We wish to thank Arvind [sic], T. Gonzalez, L. Landweber, J. Misra, and D. Wilczynski, who used the book in their own classes and gave us detailed reactions.
Thanks are also due to A. Agrawal, M. Cohen, A. Howells, R. Istre, D. Ledbetter, D. Musser and to our students in CS , CSci and who provided many insights. For administrative and secretarial help we thank M. Eul, G. Lum, J. Matheson, S. Moody, K. Pendleton, and L. To the referees for their pungent yet favorable comments we thank S.
Gerhart, T. Standish, and J. Finally, we would like to thank our institutions, the University of Southern California and the University of Minnesota, for encouraging in every way our efforts to produce this book. Ellis Horowitz Sartaj Sahni Preface to the Ninth Printing We would like to acknowledge collectively all of the individuals who have sent us comments and corrections since the book first appeared. For this printing we have made many corrections and improvements.
Download: Sartaj Sahni.pdf
Computer Algorithms by Horowitz, Sahni