Introduction to Data Structure:
A data structure is a collection of one or more variable, possibly of different types. It is a collection of data items grouped together under a single name for convenient handling. Basically, it is specialized way of storing and organizing data in a computer for using in the program. Data structure is also called records in some language, like pascal.
Data structure are generally based on the ability of a computer to fetch and store data at any place in its memory; by address and manipulated by the programmed at any time in the program me.
Data structures = Organized data + operations.
Use of data structure:
Data structure basically used to manage large amounts of data efficiently.
Data structures help to recognize complicated data, particularly in very large programs because it permits a group of related variable to be treated as a unit instead of separate items.
Typical operations on a data structure are:
Type of Data Structure:
Array: An array is a collection of similar elements stored in adjacent memory location. It is called linear data structure. It is a collection of homogeneous (similar type) data elements. Its elements are stored in computer memory in a linear way.
Stacks: A stack is an ordered collection of items into which all the insertions and deletion are performed at one end called the TOP of stack. The insertion operations are known as PUSH and deletion operation as POP. And stack processed in LIFO way, means (last in first out).
Queues: queues is defined as a list in which items may be deleted at one end called the front of the queue, and items may be inserted at the other end, called the rear of the queue. This process is called FIFO (first in first out).
Linked List: Linked list is defined as a linear collection of data elements called nodes; where each node consists of two parts; first part is information and pointer to next node. The last node contains NULL pointer.
Tree: A tree is a non linear collection of nodes. In the computer science the tree is represented upside to down i.e., the root on the top and the remaining nodes downward.
Structure: structure is a collection of logically related fields. And fields may be same or different types.
Graph: graph is a set of nodes or vertices and a set of arcs or edges where each arc is specified by a pair of nodes.