Data Structure in C++
Data structure
The computer system is used essentially as Data Management
System where ‘data’ are very important thing for it.
A data
structure is a named group of data of different types which can be processed as
a single unit. A data structure has a well-defined operations, behavior and
properties.
Primitive and non-primitive data types
The standard or fundamental data type is called primitive
data type. Ex. int, float, char.
The data types which are composed of primitive data types or
defined by used are called non-primitive data type.
Ex. array, structure,
class, enumeration, union etc.
Different Data Structures
Simple data structure
These data structures are normally built from primitive data
types.
Compound data structure
Simple data structure when combined is called compound data
structure. It is complex data structure.
Linear and non-linear data structure
A single level data structure is called linear data
structure.
Multi-level data structure is called non-linear data
structure.
Note- stack, queue and linked list use pointer data type.
Stack
Stack is list accessed and stored in a LIFO (last in first
out) technique. In stack, insertion and deletion take place only at one end,
called the top.
For eg. Stack of plates.
Queue
Queue is a FIFO (first in first out) list, where insertion
and deletion take place at the first end of queue.
For eg. Line of people.
Trees
Trees are multilevel data structure having a hierarchical
relationship among its elements called “nodes”. Top most node is called root
and bottom most node called leaves.
Each node has some pointers pointing to the
nodes before it.
Note- A binary tree is a special type of tree, where each
node has two pointer left and right.
This post is about Data Structure in C++. In the next post we will discuss the topic Array .
0 Comments