Primitive data
structures define a set of primitive
elements that do not involve any other elements as its subparts — for example,
data structures defined for integers and characters. These are generally
primary or built-in data types in programming languages.
Non-primitive data
structures are those that define a
set of derived elements such as arrays.
Static data
structure: A data structure created before program execution
begins (also called during compilation time). The variables of static data
structure have user-specified names. An array is a static data structure.
Dynamic data
structure: A data structure that is created at run-time is
called dynamic data structure. The variables of this type are not always
referenced by a user-defined name. These are accessed indirectly using their
addresses through pointers. Non-linear data structures are
generally implemented as dynamic data structures.
Linear Data Structures: A
data structure is called linear if all of its elements are arranged in the
linear order. In linear data structures, each element has the successors and
predecessors except the first and last element.
Types of Linear Data
Structures are given below:
Arrays: An
array is a collection of similar type of data items and each data item is
called an element of the array.
Linked
List: Linked list is a linear data structure which
can be seen as the collection of nodes stored at non-contiguous memory
locations. Each node of the list contains a pointer to its adjacent node.
Stack: Stack
is a linear list in which insertion and deletions are allowed only at one end,
called top.
Queue: Queue
is a linear list in which elements can be inserted only at one end called rear and
deleted only at the other end called front.
Non Linear Data
Structures: The data elements are not arranged
in sequential structure. Each item or element is connected with two or more
other items in a non-linear arrangement.
Types of Non Linear Data Structures are given below:
Trees: Trees
are multilevel data structures with a hierarchical relationship among its
elements known as nodes. The bottommost nodes in the hierarchy are called leaf
node while the topmost node is called root node. Each node
contains pointers to point adjacent nodes.
Graphs: Graphs
is a representation of the set of elements (represented by vertices) connected
by the links known as edges. A graph is different from tree in the sense that a
graph can have cycle while the tree cannot have cycles.
Persistent and Ephemeral Data Structures
A data structure that supports operations on the most recent version as well as the previous version is termed as a persistent data structure.
An ephemeral data structure is one that supports operations only on the most recent version.
Sequential Access and Direct Access Data Structure
This classification is with respect to the access operations associated with data structures.
Sequential access means that to access the nth element, the preceding (n - 1) data elements are to be accessed. A linked list is a sequential access data structure.
Direct access means that any element can be accessed without accessing its predecessor or successor; The nth element can be directly accessed. An array is an example of a direct access data structure.
Operations
on data structure
1) Traversing: Traversing
the data structure means visiting each element of the data structure in order
to perform some specific operation like searching or sorting.
2) Insertion: Insertion
can be defined as the process of adding the elements to the data structure at
any location.
3) Deletion: The
process of removing an element from the data structure is called Deletion.
4) Searching: The
process of finding the location of an element within the data structure is
called Searching.
5) Sorting: The
process of arranging the data structure in a specific order is known as
Sorting.
No comments:
Post a Comment