|
|
Introduction to Data Structures and Algorithms
by Jeff Hunter, Sr. Database Administrator
Contents
Overview
Having an in-depth understanding on every component of software engineering is not mandatory,
however, it is important to understand that the subject of data structures and algorithms is
concerned with the coding phase. The use of data structures and algorithms is the
nuts-and-blots used by programmers to store and manipulate data.
This article, along with the other examples in this section focuses on the essentials of
data structures and algorithms. Attempts will be made to understand how they work, which
structure or algorithm is best in a particular situation in an easy to understand environment.
Data Structures & Algorithms - Defined
Many algorithms apply directly to a specific data structures. When working with certain
data structures you need to know how to insert new data, search for a specified item,
and deleting a specific item.
Commonly used algorithms include are useful for:
Characteristics of Data Structures
Software engineering is the study of ways in which to create large and complex computer
applications and that generally involve many programmers and designers. At the heart of software
engineering is with the overall design of the applications and on the creation of a design
that is based on the needs and requirements of end users. While software engineering involves
the full life cycle of a software project, is includes many different components -
specification, requirements gathering, design, verification, coding, testing, quality assurance,
user acceptance testing, production, and ongoing maintenance.
A data structure is an arrangement of data in a computer's memory or even disk storage.
An example of several common data structures are arrays, linked lists, queues, stacks,
binary trees, and hash tables. Algorithms, on the other hand, are used to manipulate the
data contained in these data structures as in searching and sorting.
Data Structure
Advantages
Disadvantages
Array
Quick inserts
Fast access if index knownSlow search
Slow deletes
Fixed size
Ordered Array
Faster search than unsorted array
Slow inserts
Slow deletes
Fixed size
Stack
Last-in, first-out acces
Slow access to other items
Queue
First-in, first-out access
Slow access to other items
Linked List
Quick inserts
Quick deletesSlow search
Binary Tree
Quick search
Quick inserts
Quick deletes
(If the tree remains balanced)Deletion algorithm is complex
Red-Black Tree
Quick search
Quick inserts
Quick deletes
(Tree always remains balanced)Complex to implement
2-3-4 Tree
Quick search
Quick inserts
Quick deletes
(Tree always remains balanced)
(Similar trees good for disk storage)Complex to implement
Hash Table
Very fast access if key is known
Quick insertsSlow deletes
Access slow if key is not known
Inefficient memory usage
Heap
Quick inserts
Quick deletes
Access to largest itemSlow access to other items
Graph
Best models real-world situations
Some algorithms are slow and very complex
NOTE: The data structures shown above
(with the exception of the array) can be thought of
as Abstract Data Types (ADTs).