PROGRAMING LANGUAGE ‘C’
DATA STRUCTURE
DATA STRUCTUR
Data May Be Organized In Many Different Ways: The Logical Or Mathematical Model Of A Particular Organization Of Data Is Called Data Structure, Tha=E Choice Of A Particular Data Model Depends On Two Considerations. First, It Must Be Rich Enough In Structure Should Be Simple Enough That One Can Effectively Process The Data When Necessary.
Algorithm + Data Structure = Program
You Know That An Algorithm Is A Step-By-Step Procedure To Solve A Particular Function. That Is, It Is A Set Of Instruction Written To Carry Out Certain Tasks And The Data Structure Is The Way Of Organizing The Data With Their Logical Relationship Retained.
Classification Of Data Structures
Data Structure Are Normally Divided Into Two Broad Categories:
1. Primitive Data Structure
2. Non-Primitive Data Structure
![](https://newlaunch.net.in/wp-content/uploads/2023/11/Data-Structure-Types.webp)
Primitive Data structure
These are basic structure and are directly operated upon by the machine instructions. In general, they have different representations on different computers. Integers, floating-point numbers, character constants, string constant, pointer, etc. fall in this type of data structure.
Non-primitive data structure
These are more sophisticated Data structure. These are derived from the primitive Data structure. The non-primitive data structure emphasizes on structuring of a group of homogeneous (same type) or heterogeneous (different type) data item. Array, lists and files are example non-primitive Data structure are divided into two parts.
1. linear Data structure
2. Non linear Data structure
Linear Data structure:
linear Data structure is one in which its element from a sequence. It means each element in the structure has a unique predecessor and a unique successor.
An array is the simplest linear Data structure.
![](https://newlaunch.net.in/wp-content/uploads/2023/11/Array-Data-Structure-1024x576.png)
ARRAY: A finite collection of homogeneous(name type) elements is called as an array.
![](https://newlaunch.net.in/wp-content/uploads/2023/11/arr-var-ptr-1024x576.jpg)
stack: A stack is a linear list of data elements in which addition of a new element or deletion of an element occurs only at one end. This end is called Top of the stack. The operation of adding new element in the stack and deleting an element from the stack is called Push and Pop respectively.
![](https://newlaunch.net.in/wp-content/uploads/2023/11/Representation-of-Stack-As-Array-in-C-1024x744.webp)
![](https://newlaunch.net.in/wp-content/uploads/2023/11/Flowchart-stack_implementation.png)
Queue: A queue is a linear data structure in which addition or Insertion of a new element occurs at one end. called Rear and deletion of an element occurs at other end called Front.
![](https://newlaunch.net.in/wp-content/uploads/2023/11/Queue_Representation_Using_Array.webp)
![](https://newlaunch.net.in/wp-content/uploads/2023/11/queue-1.png)
Link list: Link list is a linear data structure. A linked list is a linear collection of similar data element , called nodes with each node containing some data and pointer(s) pointing to other nodes(s) in the list.
![](https://newlaunch.net.in/wp-content/uploads/2023/11/2560px-Adjacencylist_array_of_linkedlists_undirectedgraph.svg_-1024x518.png)
![](https://newlaunch.net.in/wp-content/uploads/2023/11/C_LinkedList_01.png)
Non-linear data structure : A non-linear data structure is one in which its elements are not from a sequence. It means unlike linear data structure, each element is not constrained to have a unique predecessor and a unique successor. Trees and graphs are the two data structure, are known as non- linear Data structures.
![](https://newlaunch.net.in/wp-content/uploads/2023/11/Binary-Tree-Program-in-C.jpg)
TREE : We observe a hierarchical relationship between various data element . This hierarchical relationship between data element can easily be represented using a non-linear data structure called trees.
![](https://newlaunch.net.in/wp-content/uploads/2023/11/download-4.png)
Graphs : A graph consists of a pair of two non-empty sets V and E, where V is a set of vertices or node and E is a set of edges. The graph is used id used to represent the non- hierarchical relationship among pairs of data elements.
![](https://newlaunch.net.in/wp-content/uploads/2023/11/download-5.png)
![](https://newlaunch.net.in/wp-content/uploads/2023/11/download-23.jpeg)