WHAT IS DATA STRUCTURE?
A Data structure is a specialized format for organizing, processing, retrieving and storing data.
Types of Data Structure Linear data structure, non linear data structure
Linear is divided into 4 types
1. Array
2. Stack
3. Queue
4. Linked List
Non linear is divided into 2 types
1. Graphs
2. Trees
DOUBLE-ENDED QUEUE
A Deque or deck is a double-ended queue.
Allow element to be added or removed on either the ends.
TYPES OF DEQUE
Input restricted deque
Element can be inserted only at
one end
Element can be removed from
both the ends
Output restricted deque
Elements can be removed only
at one end.
Elements can be inserted from
both the ends.
Algorithm Insert_front
Step 1. Start
Step 2. Check the queue is full or not as if (r == max-1) &&(f==0)
Step 3. if false update the pointer f as f = f-1
Step 4. Insert the element at pointer f as Q[f] = element
Step 5. Stop