OBJECTIVES
• To understand the concepts of ADTs
• To Learn linear data structures – lists, stacks, and queues
• To apply Tree and Graph structures
• To understand sorting, searching and hashing algorithms
TEXT BOOKS
• 1. Mark Allen Weiss, ―Data Structures and Algorithm Analysis
in C, 2nd Edition, Pearson Education,1997.
• 2. Reema Thareja, ―Data Structures Using C, Second Edition ,
Oxford University Press, 2011
UNIT I
LINEAR DATA STRUCTURES – LIST
• Abstract Data Types (ADTs)
• List ADT
• array-based implementation
• linked list implementation
– singly linked lists
– circularly linked lists
– doubly-linked lists
• applications of lists
• Polynomial Manipulation
UNIT II
LINEAR DATA STRUCTURES – STACKS, QUEUES
• Stack ADT
– Operations
– Applications
– Evaluating arithmetic expressions
– Conversion of Infix to postfix expression
• Queue ADT
– Operations
– Circular Queue
– Priority Queue
– deQueue
– applications of queues.
UNIT III
NON LINEAR DATA STRUCTURES – TREES
• Tree ADT
– Tree traversals
– Binary Tree ADT
– Expression trees
– Applications of trees
– Binary search tree ADT
– Threaded Binary Trees
– AVL Trees
– B-Tree
– B+ Tree
– Heap – Applications of heap.
UNIT IV
NON LINEAR DATA STRUCTURES – GRAPHS
• Graph-Definition
• Representation of Graph
• Types of graph
• Breadth-first traversal
• Depth-first traversal
• Topological Sort
• Bi-connectivity
• Cut vertex
• Euler circuits
• Applications of graphs.
UNIT V
SEARCHING, SORTING AND HASHING
TECHNIQUES
• Searching
– Linear Search
– Binary Search
• Sorting
– Bubble sort
– Selection sort
– Insertion sort
– Shell sort
– Radix sort
• Hashing-
– Hash Functions
– Separate Chaining
– Open Addressing
– Rehashing
– Extendible Hashing.
DATA STRUCTURE
Definition
• A data structure is a particular way of storing and
organizing data either in computer’s memory or on the
disk storage so that it can be used efficiently.
Applications of Data Structures
❖ Compiler design
❖ Operating system
❖ Statistical analysis package
❖ DBMS
❖ Numerical analysis
❖ Simulation
❖ Artificial Intelligence
CLASSIFICATION OF DATA STRUCTURES
LINEAR DATA STRUCTURES
• If the elements of a data structure are stored in a linear
or sequential order, then it is a linear data structure.
– Examples include arrays, linked lists, stacks, and queues.
• Linear data structures can be represented in memory in
two different ways.
– linear relationship between elements by means of
sequential memory locations
– linear relationship between elements by means of links.
NON-LINEAR DATA STRUCTURES
• If the elements of a data structure are not stored in a
sequential order, then it is a non-linear data structure.
The relationship of adjacency is not maintained
between elements of a non-linear data structure.
– Examples include trees and graphs.
OPERATIONS ON DATA STRUCTURES
• Traversal: Visit every part of the 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 (e.g
Increasing or Decreasing).
• Merging: Combining two similar data structures into one.
ABSTRACT DATA TYPE
An abstract data type (ADT) is the way we look at a data
structure, focusing on what it does and ignoring how it does its job.
• Abstract data type operations are
– Create,Display,Insertion,deletion,Modification
• Advantage of using ADTs
– It is reusable, robust
– It can be re-used at several places and it reduces coding efforts
– Encapsulation ensures that data cannot be corrupted
– The Working of various integrated operation cannot be tampered
with by the application program
– ADT ensures a robust data structure
List ADT
• List is the collection of elements in sequential order.
• In memory we can store the list in two ways.
– Sequential Memory Location - Array
– Pointer or links to associate the elements sequential – Linked
List.
• List is an ordered set of elements.
• The general form of the list is A1, A2, A3, ..... ,AN
A1 - First element of the list
AN - Last element of the list
N - Size of the list
If the element at position i is Ai then its successor is Ai+1 and
its predecessor is Ai-1.
List ADT
Various operations performed on List
• create -create a list
• printList() – prints all elements in the list
• find(x) – returns the position of the first occurrence of x
• remove(x) – removes x from the list if present
• insert(x, position) – inserts x into the list at the specified position
• isEmpty( ) – returns true if the list has no elements
• makeEmpty( ) – removes all elements from the list
Static Memory Allocation Dynamic Memory Allocation
In this case, variables get
allocated permanently
In this case, variables get
allocated only if your program
unit gets active
Allocation is done before
program execution
Allocation is done during
program execution
It uses the data structure called
stack for implementing static
allocation
It uses the data structure called
heap for implementing
dynamic allocation
Less efficient More efficient
There is no memory reusability There is memory reusability
and memory can be freed
when not require
LINKED LIST
Definition
A linked list is a collection of data
elements called nodes in which the linear
representation is given by links from one node
to the next node.
Reason for Linked List
• In Array are stored in consecutive memory
locations. While declaring arrays, we have to
specify the size of the array
• In linked list to make efficient use of memory,
the elements must be stored randomly at any
location rather than in consecutive locations &
not sure of the number of elements in
advance
Sample Linked List code
struct node
{
int data;
struct node *next;
} *new;
• Linked lists contain a pointer variable START
that stores the address of the first node,
• START = NULL, then the linked list is empty
and contains no nodes.
• The last node will have no next node
connected to it, so it will store a special value
called NULL.
Memory representation of Linked List
Example 1: Let us take another example to see how
two linked lists are maintained together in the
computer’s memory.
Example 2: Let us take an example to see how a structure is maintained in a
linked list that is stored in the memory.
See how the NEXT pointer is used to store the data alphabetically.
Memory Allocation and De-allocation
for a Linked List
FREE POOL AND AVAIL POINTER
VARIABLE
TYPES OF LINKED LISTS
There are different types of linked lists. They are
1.Singly Linked List
2.Doubly Linked list
3.Circular Linked List
4.Circular Doubly Linked List
SINGLY LINKED LISTS
• every node contains some data and a pointer
to the next node of the same data type.
• A singly linked list allows traversal of data only
in one way
Traversing a Linked List
• Algorithm for traversing a linked list
Algorithm to print the number of
nodes in a linked list
Searching for a Value in a Linked List
Illustration of Searching algorithm
Inserting a New Node in a Linked List
Case 1: The new node is inserted at the beginning.
Case 2: The new node is inserted at the end.
Case 3: The new node is inserted after a given node.
Case 4: The new node is inserted before a given node.
Overflow :
It is a condition that occurs when we try to insert a
node to a linked list that is full. It happens when AVAIL =
NULL (or) no free memory cell is present in the system.
Case 1: The new node is inserted at the beginning.
add a new node with data 9 and add it as the first node of the list.
Fig: Algorithm to insert a new node at the beginning
Case 2: The new node is inserted at the end.
add a new node with data 9 as the last node of the list
Algorithm to insert a new node at the end
Case 3: The new node is inserted after a given node.
Algorithm to insert a new node after a node
that has value NUM
Case 4: The new node is inserted before a given node
Algorithm to insert a new node before a node that
has value NUM
Deleting a Node from a Linked List
A node is deleted from an already existing linked list.
three cases:
Case 1: The first node is deleted.
Case 2: The last node is deleted.
Case 3: The node after a given node is deleted.
Underflow :
It is a condition that occurs when we try to delete a
node from a linked list that is empty. This happens when
START = NULL or when there are no more nodes to delete.
Case 1: The first node is deleted.
Case 2: The last node is deleted.
Algorithm to delete the last node
Case 3: The node after a given node is deleted.
Algorithm to delete the node after a given node
CIRCULAR LINKED LISTs
Definition
In a circular linked list is similar to singly linked
list except that the last node contains a pointer to
the first node of the list.
Types
❖ Circular singly linked list
❖ Circular doubly linked list.
Memory representation of a circular linked list
• We can traverse the list until we find the NEXT entry that contains the
address of the first node of the list.
• This denotes the end of the linked list, that is, the node that contains
the address of the first node is actually the last node of the list.
Memory representation of two circular linked
lists stored in the memory
Inserting a New Node in a Circular
Linked List
• Case 1: The new node is inserted at the
beginning of the circular linked list.
• Case 2: The new node is inserted at the end of
the circular linked list.
Case 1: The new node is inserted at the beginning of
the circular linked list.
• we want to add a new node with data 9 as the first node of
the list
Algorithm to insert a new node at the beginning
Case 2: The new node is inserted at the end of the
circular linked list.
• to add a new node with data 9 as the last node of the list
Algorithm to insert a new node at the end
Deleting a Node from a Circular
Linked List
• Case 1: The first node is deleted.
• Case 2: The last node is deleted.
Case 1: The first node is deleted.
• to delete a node from the beginning of the list
Algorithm to delete the first node
Case 2: The last node is deleted.
• to delete the last node from the linked list
Algorithm to delete the last node
DOUBLY LINKED LISTS
• A doubly linked list or a two-way linked list is a more
complex type of linked list which contains a pointer to the
next as well as the previous node in the sequence.
• Therefore, it consists of three parts—data, a pointer to
the next node, and a pointer to the previous node
Structure of a doubly linked list
struct node
{
struct node *prev;
int data;
struct node *next;
};
Advantage of doubly linked list:
Doubly linked list is that it makes searching twice as
efficient
Disadvantage of doubly linked list:
Doubly linked list calls for more space per node and more
expensive basic operations.
Memory representation of a doubly linked list
1. The PREV field of the first node and the NEXT field of the last node will contain
NULL or –1 .
2. The PREV field is used to store the address of the preceding node.
3. The NEXT field is used to store the address of the successor node.
Inserting a New Node in a Doubly
Linked List
Case 1: The new node is inserted at the beginning.
Case 2: The new node is inserted at the end.
Case 3: The new node is inserted after a given node.
Case 4: The new node is inserted before a given node.
Case 1: The new node is inserted at the beginning.
• add a new node with data 9 as the first node of
the list
Algorithm to insert a new node at the beginning
Case 2: The new node is inserted at the end.
• to add a new node with data 9 as the last node of the list
Algorithm to insert a new node at the end
Case 3: The new node is inserted after a given node.
• to add a new node with value 9 after the node containing 3
Algorithm to insert a new node after a given node
Case 4: The new node is inserted before a given node.
• to add a new node with value 9 before the node containing 3.
Algorithm to insert a new node before a given node
Deleting a Node from a Doubly Linked List
• Case 1: The first node is deleted.
• Case 2: The last node is deleted.
• Case 3: The node after a given node is deleted.
• Case 4: The node before a given node is deleted.
Case 1: The first node is deleted
• to delete a node from the beginning of the list
Algorithm to delete the first node
Case 2: The last node is deleted.
• to delete the last node from the linked list
Algorithm to delete the last node
Case 3: The node after a given node is deleted.
• delete the node that succeeds the node which contains data value 4
Algorithm to delete a node after a given node
Case 4: The node before a given node is deleted.
• to delete the node preceding the node with value 4 .
Algorithm to delete a node before a given node
CIRCULAR DOUBLY LINKED LISTs
• The circular doubly linked list does not contain NULL in the
previous field of the first node and the next field of the last
node.
• Rather, the next field of the last node stores the address of the
first node of the list, i.e., START. Similarly, the previous field
of the first field stores the address of the last node
Memory representation of a circular doubly linked list
Inserting a New Node in a Circular
Doubly Linked List
• Case 1: The new node is inserted at the beginning.
• Case 2: The new node is inserted at the end.
Case 1: The new node is inserted at the beginning.
Algorithm to insert a new node at the beginning
Case 2: The new node is inserted at the end.
Algorithm to insert a new node at the end
Deleting a Node from a Circular
Doubly Linked List
• ➢ Case 1: The first node is deleted.
• ➢ Case 2: The last node is deleted.
Case 1: The first node is deleted.
Algorithm to delete the first node
Case 2: The last node is deleted.
Algorithm to delete the last node
APPLICATIONS OF LINKED LISTS
• Polynomial Representation
– Consider a polynomial 6x3 + 9x2 + 7x + 1
– Linked representation of a polynomial
unit 1.pptx
unit 1.pptx
unit 1.pptx
unit 1.pptx

unit 1.pptx

  • 1.
    OBJECTIVES • To understandthe concepts of ADTs • To Learn linear data structures – lists, stacks, and queues • To apply Tree and Graph structures • To understand sorting, searching and hashing algorithms TEXT BOOKS • 1. Mark Allen Weiss, ―Data Structures and Algorithm Analysis in C, 2nd Edition, Pearson Education,1997. • 2. Reema Thareja, ―Data Structures Using C, Second Edition , Oxford University Press, 2011
  • 2.
    UNIT I LINEAR DATASTRUCTURES – LIST • Abstract Data Types (ADTs) • List ADT • array-based implementation • linked list implementation – singly linked lists – circularly linked lists – doubly-linked lists • applications of lists • Polynomial Manipulation
  • 3.
    UNIT II LINEAR DATASTRUCTURES – STACKS, QUEUES • Stack ADT – Operations – Applications – Evaluating arithmetic expressions – Conversion of Infix to postfix expression • Queue ADT – Operations – Circular Queue – Priority Queue – deQueue – applications of queues.
  • 4.
    UNIT III NON LINEARDATA STRUCTURES – TREES • Tree ADT – Tree traversals – Binary Tree ADT – Expression trees – Applications of trees – Binary search tree ADT – Threaded Binary Trees – AVL Trees – B-Tree – B+ Tree – Heap – Applications of heap.
  • 5.
    UNIT IV NON LINEARDATA STRUCTURES – GRAPHS • Graph-Definition • Representation of Graph • Types of graph • Breadth-first traversal • Depth-first traversal • Topological Sort • Bi-connectivity • Cut vertex • Euler circuits • Applications of graphs.
  • 6.
    UNIT V SEARCHING, SORTINGAND HASHING TECHNIQUES • Searching – Linear Search – Binary Search • Sorting – Bubble sort – Selection sort – Insertion sort – Shell sort – Radix sort • Hashing- – Hash Functions – Separate Chaining – Open Addressing – Rehashing – Extendible Hashing.
  • 7.
    DATA STRUCTURE Definition • Adata structure is a particular way of storing and organizing data either in computer’s memory or on the disk storage so that it can be used efficiently. Applications of Data Structures ❖ Compiler design ❖ Operating system ❖ Statistical analysis package ❖ DBMS ❖ Numerical analysis ❖ Simulation ❖ Artificial Intelligence
  • 8.
  • 9.
    LINEAR DATA STRUCTURES •If the elements of a data structure are stored in a linear or sequential order, then it is a linear data structure. – Examples include arrays, linked lists, stacks, and queues. • Linear data structures can be represented in memory in two different ways. – linear relationship between elements by means of sequential memory locations – linear relationship between elements by means of links. NON-LINEAR DATA STRUCTURES • If the elements of a data structure are not stored in a sequential order, then it is a non-linear data structure. The relationship of adjacency is not maintained between elements of a non-linear data structure. – Examples include trees and graphs.
  • 10.
    OPERATIONS ON DATASTRUCTURES • Traversal: Visit every part of the 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 (e.g Increasing or Decreasing). • Merging: Combining two similar data structures into one.
  • 11.
    ABSTRACT DATA TYPE Anabstract data type (ADT) is the way we look at a data structure, focusing on what it does and ignoring how it does its job. • Abstract data type operations are – Create,Display,Insertion,deletion,Modification • Advantage of using ADTs – It is reusable, robust – It can be re-used at several places and it reduces coding efforts – Encapsulation ensures that data cannot be corrupted – The Working of various integrated operation cannot be tampered with by the application program – ADT ensures a robust data structure
  • 12.
    List ADT • Listis the collection of elements in sequential order. • In memory we can store the list in two ways. – Sequential Memory Location - Array – Pointer or links to associate the elements sequential – Linked List. • List is an ordered set of elements. • The general form of the list is A1, A2, A3, ..... ,AN A1 - First element of the list AN - Last element of the list N - Size of the list If the element at position i is Ai then its successor is Ai+1 and its predecessor is Ai-1.
  • 13.
    List ADT Various operationsperformed on List • create -create a list • printList() – prints all elements in the list • find(x) – returns the position of the first occurrence of x • remove(x) – removes x from the list if present • insert(x, position) – inserts x into the list at the specified position • isEmpty( ) – returns true if the list has no elements • makeEmpty( ) – removes all elements from the list
  • 14.
    Static Memory AllocationDynamic Memory Allocation In this case, variables get allocated permanently In this case, variables get allocated only if your program unit gets active Allocation is done before program execution Allocation is done during program execution It uses the data structure called stack for implementing static allocation It uses the data structure called heap for implementing dynamic allocation Less efficient More efficient There is no memory reusability There is memory reusability and memory can be freed when not require
  • 16.
    LINKED LIST Definition A linkedlist is a collection of data elements called nodes in which the linear representation is given by links from one node to the next node.
  • 17.
    Reason for LinkedList • In Array are stored in consecutive memory locations. While declaring arrays, we have to specify the size of the array • In linked list to make efficient use of memory, the elements must be stored randomly at any location rather than in consecutive locations & not sure of the number of elements in advance
  • 18.
    Sample Linked Listcode struct node { int data; struct node *next; } *new;
  • 19.
    • Linked listscontain a pointer variable START that stores the address of the first node, • START = NULL, then the linked list is empty and contains no nodes. • The last node will have no next node connected to it, so it will store a special value called NULL.
  • 20.
  • 21.
    Example 1: Letus take another example to see how two linked lists are maintained together in the computer’s memory.
  • 22.
    Example 2: Letus take an example to see how a structure is maintained in a linked list that is stored in the memory. See how the NEXT pointer is used to store the data alphabetically.
  • 23.
    Memory Allocation andDe-allocation for a Linked List
  • 24.
    FREE POOL ANDAVAIL POINTER VARIABLE
  • 25.
    TYPES OF LINKEDLISTS There are different types of linked lists. They are 1.Singly Linked List 2.Doubly Linked list 3.Circular Linked List 4.Circular Doubly Linked List
  • 26.
    SINGLY LINKED LISTS •every node contains some data and a pointer to the next node of the same data type. • A singly linked list allows traversal of data only in one way
  • 27.
    Traversing a LinkedList • Algorithm for traversing a linked list
  • 28.
    Algorithm to printthe number of nodes in a linked list
  • 29.
    Searching for aValue in a Linked List
  • 30.
  • 31.
    Inserting a NewNode in a Linked List Case 1: The new node is inserted at the beginning. Case 2: The new node is inserted at the end. Case 3: The new node is inserted after a given node. Case 4: The new node is inserted before a given node. Overflow : It is a condition that occurs when we try to insert a node to a linked list that is full. It happens when AVAIL = NULL (or) no free memory cell is present in the system.
  • 32.
    Case 1: Thenew node is inserted at the beginning. add a new node with data 9 and add it as the first node of the list. Fig: Algorithm to insert a new node at the beginning
  • 33.
    Case 2: Thenew node is inserted at the end. add a new node with data 9 as the last node of the list
  • 34.
    Algorithm to inserta new node at the end
  • 35.
    Case 3: Thenew node is inserted after a given node.
  • 36.
    Algorithm to inserta new node after a node that has value NUM
  • 37.
    Case 4: Thenew node is inserted before a given node
  • 38.
    Algorithm to inserta new node before a node that has value NUM
  • 39.
    Deleting a Nodefrom a Linked List A node is deleted from an already existing linked list. three cases: Case 1: The first node is deleted. Case 2: The last node is deleted. Case 3: The node after a given node is deleted. Underflow : It is a condition that occurs when we try to delete a node from a linked list that is empty. This happens when START = NULL or when there are no more nodes to delete.
  • 40.
    Case 1: Thefirst node is deleted.
  • 41.
    Case 2: Thelast node is deleted.
  • 42.
    Algorithm to deletethe last node
  • 43.
    Case 3: Thenode after a given node is deleted.
  • 44.
    Algorithm to deletethe node after a given node
  • 45.
    CIRCULAR LINKED LISTs Definition Ina circular linked list is similar to singly linked list except that the last node contains a pointer to the first node of the list. Types ❖ Circular singly linked list ❖ Circular doubly linked list.
  • 46.
    Memory representation ofa circular linked list • We can traverse the list until we find the NEXT entry that contains the address of the first node of the list. • This denotes the end of the linked list, that is, the node that contains the address of the first node is actually the last node of the list.
  • 47.
    Memory representation oftwo circular linked lists stored in the memory
  • 48.
    Inserting a NewNode in a Circular Linked List • Case 1: The new node is inserted at the beginning of the circular linked list. • Case 2: The new node is inserted at the end of the circular linked list.
  • 49.
    Case 1: Thenew node is inserted at the beginning of the circular linked list. • we want to add a new node with data 9 as the first node of the list
  • 50.
    Algorithm to inserta new node at the beginning
  • 51.
    Case 2: Thenew node is inserted at the end of the circular linked list. • to add a new node with data 9 as the last node of the list
  • 52.
    Algorithm to inserta new node at the end
  • 53.
    Deleting a Nodefrom a Circular Linked List • Case 1: The first node is deleted. • Case 2: The last node is deleted.
  • 54.
    Case 1: Thefirst node is deleted. • to delete a node from the beginning of the list
  • 55.
    Algorithm to deletethe first node
  • 56.
    Case 2: Thelast node is deleted. • to delete the last node from the linked list
  • 57.
    Algorithm to deletethe last node
  • 58.
    DOUBLY LINKED LISTS •A doubly linked list or a two-way linked list is a more complex type of linked list which contains a pointer to the next as well as the previous node in the sequence. • Therefore, it consists of three parts—data, a pointer to the next node, and a pointer to the previous node
  • 59.
    Structure of adoubly linked list struct node { struct node *prev; int data; struct node *next; }; Advantage of doubly linked list: Doubly linked list is that it makes searching twice as efficient Disadvantage of doubly linked list: Doubly linked list calls for more space per node and more expensive basic operations.
  • 60.
    Memory representation ofa doubly linked list 1. The PREV field of the first node and the NEXT field of the last node will contain NULL or –1 . 2. The PREV field is used to store the address of the preceding node. 3. The NEXT field is used to store the address of the successor node.
  • 61.
    Inserting a NewNode in a Doubly Linked List Case 1: The new node is inserted at the beginning. Case 2: The new node is inserted at the end. Case 3: The new node is inserted after a given node. Case 4: The new node is inserted before a given node.
  • 62.
    Case 1: Thenew node is inserted at the beginning. • add a new node with data 9 as the first node of the list
  • 63.
    Algorithm to inserta new node at the beginning
  • 64.
    Case 2: Thenew node is inserted at the end. • to add a new node with data 9 as the last node of the list
  • 65.
    Algorithm to inserta new node at the end
  • 66.
    Case 3: Thenew node is inserted after a given node. • to add a new node with value 9 after the node containing 3
  • 67.
    Algorithm to inserta new node after a given node
  • 68.
    Case 4: Thenew node is inserted before a given node. • to add a new node with value 9 before the node containing 3.
  • 69.
    Algorithm to inserta new node before a given node
  • 70.
    Deleting a Nodefrom a Doubly Linked List • Case 1: The first node is deleted. • Case 2: The last node is deleted. • Case 3: The node after a given node is deleted. • Case 4: The node before a given node is deleted.
  • 71.
    Case 1: Thefirst node is deleted • to delete a node from the beginning of the list
  • 72.
    Algorithm to deletethe first node
  • 73.
    Case 2: Thelast node is deleted. • to delete the last node from the linked list
  • 74.
    Algorithm to deletethe last node
  • 75.
    Case 3: Thenode after a given node is deleted. • delete the node that succeeds the node which contains data value 4
  • 76.
    Algorithm to deletea node after a given node
  • 77.
    Case 4: Thenode before a given node is deleted. • to delete the node preceding the node with value 4 .
  • 78.
    Algorithm to deletea node before a given node
  • 79.
    CIRCULAR DOUBLY LINKEDLISTs • The circular doubly linked list does not contain NULL in the previous field of the first node and the next field of the last node. • Rather, the next field of the last node stores the address of the first node of the list, i.e., START. Similarly, the previous field of the first field stores the address of the last node
  • 80.
    Memory representation ofa circular doubly linked list
  • 81.
    Inserting a NewNode in a Circular Doubly Linked List • Case 1: The new node is inserted at the beginning. • Case 2: The new node is inserted at the end.
  • 82.
    Case 1: Thenew node is inserted at the beginning.
  • 83.
    Algorithm to inserta new node at the beginning
  • 84.
    Case 2: Thenew node is inserted at the end.
  • 85.
    Algorithm to inserta new node at the end
  • 86.
    Deleting a Nodefrom a Circular Doubly Linked List • ➢ Case 1: The first node is deleted. • ➢ Case 2: The last node is deleted.
  • 87.
    Case 1: Thefirst node is deleted.
  • 88.
    Algorithm to deletethe first node
  • 89.
    Case 2: Thelast node is deleted.
  • 90.
    Algorithm to deletethe last node
  • 91.
    APPLICATIONS OF LINKEDLISTS • Polynomial Representation – Consider a polynomial 6x3 + 9x2 + 7x + 1 – Linked representation of a polynomial

Editor's Notes

  • #2 application: https://www.youtube.com/watch?v=d_XvFOkQz5k https://www.youtube.com/watch?v=PoxdkCSsD3A
  • #27 https://www.youtube.com/watch?v=XqDhKDieTKE
  • #49 https://www.youtube.com/watch?v=7gNlnqhqbsg https://www.youtube.com/watch?v=KBdTYkYO3eo