Linear Data Structure - 👑 सार्थक मुंड S3 🤴🏻

Linear Data Structure

types of Linear Data Structure

What is Linear data structure ? Describe the various types of Linear data structure ?

Data Structure :-

    Data structure is the logical or mathematical organization of data and access data from memory. Actually in our programming data stored in main memory(RAM) and to develop efficient software of film ware we need to care about money. To efficiency we required Data Structure.
    There are two different types of data structure :-
1. Linear Data Structure : In linear data structure data elements sorted in sequential manner .  Array, Linked list, Stack and Queue are the types of linear data structure.
2. Non linear Data Structure : In non linear data structure data elements are not sorted in the sequence manner. Tree and Graph are the type of non linear data structure.

TYPES OF LINEAR DATA STRUCTURE :-

A data structure is a particular way of organizing data in a computer so that it can be used effectively. The idea is to reduce the space and time complexities of different tasks. Below is an overview of some popular linear data structures.
1. Array
2. Linked List
3. Stack
4. Queue

1. Array :-

    Array is the collection of similar data types or elements addressed by a common variable name.
“Or”  An array is a collection of  2 or more adjacent memory location containing same type of data.
▪️ This memory locations are called array elements.
▪️ 1D array is mathematically called Vector.
For example, a nine element integer array foo may be logically represented as :

2. Linked List :-

    Linked list is a self referential structure that means one member of structure is itself refer to or point to itself.
For Ex. :-
Struct node
{
    int data;
   struct node *link;
}
    Here, the member of “struct node *link” points to the structure itself. This type of structure is called a linked list.
   There are 3 types of  linked list. i.e. :
i. Singly Linked List
ii. Doubly Linked List
iii. Circular Linked list

Operations on Linked List :-
▪️ Traversal :- Visit every part of data structure.
▪️ Search :- Traversal through the data structure for a given element.
▪️ Insertion :- adding new elements to the data structure.
▪️ Deletion :- Removing an element from the data structure.
▪️ Sorting :- Rearranging the elements in some type of order(i.e. Increasing or Decreasing).
▪️ Merging :- Combining two similar data structure into one.

3. Stack :-

    Stack is a linear data structure or it is a homogeneous data structure.
“Or” Stack is an ordered collection of homogeneous data element where the insertion and deletion operation takes place only at one end.
▪️ In the general life example we can take suppose, we want to place the plate on a trey the first plate will be at the lower position and the last plate placed at the higher position.
▪️ The stack is just similar or it is represented with the help of array and linked list but the only difference is that in case of array and linked list we can insert or delete the element at any place. But in case of stack the insertion and the deletion can only done at the top of the stack. This behavior of stack is known as the last in fast out.

4. Queue :-

   Queues are a type of container adapters which operate in a first in first out (FIFO) type of arrangement. Elements are inserted at the back (end) and are deleted from the front.
▪️ The functions supported by queue are :
🔹 empty() : Returns whether the queue is empty.
🔹 size() : Returns the size of the queue.
🔹 queue::swap() in C++ STL : Exchange the contents of two queues but the queues must be of same type, although sizes may differ.
🔹 queue::emplace() in C++ STL : Insert a new element into the queue container, the new element is added to the end of the queue.
🔹 queue::front() and queue::back() in C++ STL : front() function returns a reference to the first element of the queue. back() function returns a reference to the last element of the queue.
🔹 push(g) and pop() : push() function adds the element ‘g’ at the end of the queue. pop() function deletes the first element of the queue.

Must Read :-

  1. Blogger Tutorial
  2. C Programs
  3. C++ Programs
  4. Java Programs
  5. Python Programs
  6. Programming Notes 
  7. Questions & Answers
  8. My Codes : HTML, CSS & JS
Previous article
Next article

4 Comments to

Articles Ads

Articles Ads 1

Articles Ads 2

Advertisement Ads