Data Structures
This book is about the creation and analysis of efficient data structures. It covers:
- the primitive node structure;
- asymptotic notation for mathematically discussing performance characteristics;
- built-in arrays;
- list structures built from either nodes or arrays;
- iterators as an abstract model of enumerating the items in a sequence;
- stacks and queues for computing with last-in/first-out and first-in/first-out orderings;
- binary and general tree structures for searching or representing hierarchical relationships;
- min and max heaps for representing ordering based on priorities;
- graph structures for representing more general relationships between data elements;
- hash tables for the efficient retrieval of strings and other objects; and finally
- trade-offs between the structures, and strategies for picking the most appropriate ones.
To understand the material in this book you should be comfortable enough in a programming language to be capable of working with and writing your own variables, arithmetic expressions, if-else conditions, loops, subroutines (also known as functions), pointers (also known as references or object handles), structures (also known as records or classes), simple input and output, and simple recursion.
Because many different languages approach the construction of data structures differently, we use pseudo-code so that you can translate the code into your own language.
Table of Chapters[edit | edit source]
Contribute to the development of this book![edit | edit source]
A Wikibook is an undertaking similar to an open-source software project: A contributor creates content for the project to help others, for personal enrichment, or to accomplish something for the contributor's own work (e.g., lecture preparation).
An open book, just like an open program, requires time to complete, but it can benefit greatly from even modest contributions from readers. For example you can fix "bugs" in the text (where the bug might be typographic, expository, technical, aesthetic or otherwise) in order to make a better book. If you find an opportunity to fix a bug, simply click on "edit", make your changes, and click on save. Other contributors may review your changes to be sure they are appropriate for the book. If you are unsure, you can visit the discussion page and ask there. Use common sense.
If you would like to make bigger contributions, you can take a look at the sections or chapters that are too short or otherwise need more work and start writing! Be sure to skim the rest of the book first in order to avoid duplication of content. Additionally, you should read the Guidelines for Contributors page for consistency tips and advice.
Note that you don't need to contribute everything at once. You can add the template "{{TODO|description of what remains to be done}}", to pages and perhaps someone else will finish those parts for you.
This book is intentionally kept narrow-in-focus in order to make contributions easier (because then the end-goal is clearer). This book is part one of a series of three computer science textbooks on algorithms, continuing on to the techniques of algorithms in Algorithms and ending with Advanced Data Structures and Algorithms. If you would like to contribute a topic not already listed in any of the three books try putting it in the Advanced book, which is more eclectic in nature. Or, if you think the topic is fundamental, you can go to either the Algorithms or the Data Structures discussion page and make a proposal.
Additionally, implementations of the data structures (in either Ada, C, C#, Perl, Python, Java, Ruby, or Scheme) as an appendix are welcome.
References[edit | edit source]
[Aho] | Alfred V. Aho, Jeffrey D. Ullman, John E. Hopcroft. Data Structures and Algorithms. Addison Wesley, 1983. | |
[CLRS] | Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein. Introduction to Algorithms. McGraw-Hill, 2001. | |
[Knuth] | Donald E. Knuth. The Art of Computer Programming, Volumes 1-3. Addison-Wesley Professional, 1998. | |
[Kishor] | S.B. Kishor Data Structures, Edition 3. Das Ganu Prakashan, Nagpur, 2008. | |
[Judith] | Judith L Gersting. Mathematical Structures for Computer Science. W.H. Freeman and Company,2014. |
Additionally, as an online reference to the scope of algorithms today: Dictionary of Algorithms