Data Structure and Algorithms Lecture 1
Data Structure and Algorithms Lecture 1
integer, boolean, character, float, Array, Linked List, Stack, etc. are
etc. are some examples of some examples of non-primitive
primitive data structures. data structures.
Linked list
queue
tree stack
Selection of Data Structure
The choice of particular data model
depends on two consideration:
It must be rich enough in structure to represent
the relationship between data elements
The structure should be simple enough that one
can effectively process the data when necessary
Types of Data Structure
Linear: In Linear data structure, values are
arrange in linear fashion.
Array: Fixed-size
Linked-list: Variable-size
Stack: Add to top and remove from top
Queue: Add to back and remove from front
Priority queue: Add anywhere, remove the
highest priority
Types of Data Structure
Non-Linear: The data values in this structure are
not arranged in order.
Hash tables: Unordered lists which use a ‘hash function’
to insert and search
Tree: Data is organized in branches.
Graph: A more general branching structure, with less
strict connection conditions than for a tree
Type of Data Structures
Homogenous: In this type of data structures,
values of the same types of data are stored.
Array
Data Structures
Physical implementation of an ADT
data structures used in implementations are provided in
a language (primitive or built-in) or are built from the
language constructs (user-defined)
Each operation associated with the ADT is implemented by one
or more subroutines in the implementation
Abstract Data Type
ADTs support abstraction, encapsulation, and
information hiding.
insert/push Data3
remove/pop
Data2
top
make empty Data1
Queues
Collection with access only to the item that
has been present the longest
Last in last out or first in first out
enqueue, dequeue, front
priority queues and dequeue
Front Back