DATA STRUCTURES
: STACK,QUEUE,LINKED LIST
APARNA P,AD HOC FACULTY CSED NITC
Data Structures are structures programmed to store
ordered data inorder to performs operations easily .
It represents the knowledge of data to be organized in
Data memory.
structures
Designed and implemented in such a way that it
reduces the complexity and increases the efficiency.
Abstract data type(ADT) with a
bounded(predefined) capacity
Basic operations/features:
1. Insertion or PUSH
Stack 2.Deletion or POP
3. Top
4. Isempty or Underflow
5.Isfull or Overflow
Every time an element is added, it goes on the
top of the stack, the only element that can be
removed is the element that was at the top of
the stack.
Real world
scenario of
Stack
Stack operations may involve initializing the stack,
using it and then de-initializing it.
1. push() − Pushing (storing) an element on the stack.
2. pop() − Removing (accessing) an element from the
Basic stack.
Operations
To use a stack efficiently, we need to check the status
of stack as well. For the same purpose, the following
functionality is added to stacks
3. isFull() − check if stack is full.
4. isEmpty() − check if stack is empty
Queue is also an abstract data type
The first element is inserted from one end called
REAR(also called tail), and the deletion of existing
element takes place from the other end called as
FRONT(also called head).
This makes queue as FIFO(First in First Out) data
structure, which means that element inserted first will
Queue also be removed first.
Queue operations may involve initializing or defining the queue,
utilizing it, and then completely erasing it from the memory. Here
we shall try to understand the basic
operations associated with queues −
Basic 1. enqueue() − add (store) an item to the queue.
Operations 2. dequeue() − remove (access) an item from the queue.
Few more functions are required to make the above-mentioned
queue operation efficient.
These are −
3. isfull() − Checks if the queue is full.
4.isempty() − Checks if the queue is empty.
A linked list is a sequence of data structures, which are
connected together via links.
Linked list Linked List is a sequence of links which contains items.
Each link contains a connection to another link
Linked list
Types of lists
There are two basic types of linked list
Singly Linked list
Doubly linked list
Singly Linked List
Each node has only one link part
Each link part contains the address of the next node in
the list
Link part of the last node contains NULL value which
signifies the end of the node
Insertion
Basic Deletion
operations Searching
reversal
Searching involves finding the required element in the
list
We can use various techniques of searching like linear
Searching a search or binary search where binary search is more
SLL efficient in case of Arrays
But in case of linked list since random access is not
available it would become complex to do binary search
in it
We can perform simple linear search traversal
In linear search each node is traversed till the data in
the node matches with the required value
1.Doubly linked list is a linked data structure that
consists of a set of sequentially linked records called
nodes.
2. Each node contains three fields ::
- one is data part which contain data only.
- two other field is links part that are point or references
to the previous or to the next node in the sequence of
nodes.
3. The beginning and ending nodes' previous and next
links, respectively.