Data Structure and Algorithm
Data Structure and Algorithm
& ALGORITHMS
PRIMITIVE DATA STRUCTURES
These are the structures which are supported at the
machine level, they can be used to make non-primitive
data structures. These are integral and are pure in form.
They have predefined behavior and specifications.
Examples: integer, float, character, pointers
The pointers, however don’t hold a data value, instead,
they hold memory addresses of the data values.
These are also called the reference data types.
NON-PRIMITIVE DATA
STRUCTURES
The non-primitive data structures cannot be
performed without the primitive data structures.
Although, they too are provided by the system itself yet
they are derived data structures and cannot be formed
without using the primitive data structures.
The Non-primitive data structures are further divided
into the following categories:
Arrays
Files
Lists
■ Linear Lists
■ Stacks
■ Queues)
■ Non-Linear Lists
■ Graphs
■ Trees
ARRAYS
Arrays are a homogeneous and contiguous collection
of same data types. They have a static memory
allocation technique, which means, if memory space is
allocated for once, it cannot be changed during runtime.
The arrays are used to implement vectors, matrices
and also other data structures. If we do not know the
memory to be allocated in advance then array can lead
to wastage of memory. Also, insertions and deletions are
complex in arrays since elements are stored in
consecutive memory allocations.
FILES
A file is a collection of records. The file data structure is
primarily used for managing large amounts of data which is
not in the primary storage of the system. The files help us to
process, manage, access and retrieve or basically work with
such data, easily.
LISTS
The lists support dynamic memory allocation. The
memory space allocated, can be changed at run time
also.
A) LINEAR LISTS