Download Data Structures What is a Data Structure?

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Data Structures
What is a Data Structure?
A data structure is a way to arrange data in a computer's memory
or even disk storage for efficient access. The most complex
algorithms would be useless if data is not stored in a manner that
makes sense to that algorithm.
The data can be stored with the help of simple data types such as
int, char, float etc. However, these are not always sufficient for the
execution of a program in a timely manner. This is the reason for
using data structures.
A data structure consists of a
–
–
–
domain : single or several data items
structure : rules defining the relation among the components
a set of operations
Why use Data Structures?
In the design of many types of programs the choice of
data structures is very important. When building large
systems, it is known that the difficulty of
implementation and the quality and performance of the
final result depends heavily on choosing the best data
structure. After the data structures are chosen, the
algorithms to be used often become relatively obvious.
Therefore, the choice of appropriate data structures is
crucial.
Why use Data Structures?
There are many data structures that are already
defined. Programming languages already come with
some built-in data structures such as arrays and
records. Others are user-defines structures such as
stacks and queues.
Most of these data structures have associated
algorithms to perform operations such as search or
insert, that maintain the properties of them, and they
are independent of any particular implementation.
Advantages of a Data Structures
Often a carefully chosen data structure will
allow a more efficient algorithm to be used. A
well-designed data structure allows a variety of
critical operations to be performed on it, using
as little resources and time as possible.
Example
Stack:
Stores data which are inserted or deleted in a
LIFO manner
Operations:
push, pop, top, size, isEmpty
Uses:
Backtracking – implementing an ‘undo’
Reversing Data