Fundamentals of Computer Programming with C# HTML version

Chapter 19. Data Structures
and Algorithm Complexity
In This Chapter
In this chapter we will compare the data structures we have learned so far
by the performance (execution speed) of the basic operations (addition,
search, deletion, etc.). We will give specific tips in what situations what data
structures to use. We will explain how to choose between data structures
like hash-tables, arrays, dynamic arrays and sets implemented by hash-tables
or balanced trees. Almost all of these structures are implemented as part of
NET Framework, so to be able to write efficient and reliable code we have
to learn to apply the most appropriate structures for each situation.
Why Are Data Structures So Important?
You may wonder why we pay so much attention to data structures and
why we review them in such a great details. The reason is we aim to make
out of you thinking software engineers. Without knowing the basic data
structures and computer algorithms in programming well, you cannot be good
developers and risk to stay an amateur. Whoever knows data structures
and algorithms well and starts thinking about their correct use has big
chance to become a professional – one that analyzes the problems in depth
and proposes efficient solutions.
There are hundreds of books written on this subject. In the four volumes,
named "The Art of Computer Programming", Donald Knuth explains
data structures and algorithms in more than 2500 pages. Another author,
Niklaus Wirth, has named his book after the answer to the question "why
are data structures so important", which is "Algorithms + Data Structures
= Programs". The main theme of the book is again the fundamental
algorithms and data structures in programming.
Data structures and algorithms are the fundamentals of
programming. In order to become a good developer it is
essential to master the basic data structures and algorithms
and learn to apply them in the right way.
To a large degree our book is focused on learning data structures and
algorithms along with the programming concepts, language syntax and
problem solving. We also try to illustrate them in the context of modern
software engineering with C# and .NET Framework.