SlideShare a Scribd company logo
Dgroup@mca.com   ************




Presentation
     ON




     BY
  D Group
Member of D group
      Privanka Dabhai
      Insert at first in single linked list

       Praful Aparnathi
       Insert at Last in single linked list

       Arpan Shah
       Insert at Order in single linked list

       Narendra Chauhan
       Delete in single linked list

       Ram Sanjay
       Copy in single linked list

       Rushabh Bhavsar
       MCQ

       Bhavisha Purohit
Index Of Linear Linked List



     INDEX
  1.Introduction
  2.Algorithms
  3.MCQ
Introduction Of Linked List

  Introduction Of Linked List

This subsection describes in detail the
representation of linear lists using linked
allocation. Algorithms such as the insertion of
nodes and the deletion of nodes from a linked
linear list are given.

The programming aspects of linked allocation
are discussed both from the simulation point of
view, using arrays, and from the programmer
defined data type facility available in pascal.
Introduction Of Linked List

  Introduction Of Linked List

The first approach is the one which is usually taken in
programming linked represented structures in languages
that do not have pointer or link facilities, such as
FORTRAN,ALGOL 60 and BASIC, while the second
approach is used in languages that do have pointer
facilities, such as Pascal, PL/ISNOBOL,ALGOL 68 and
ALGOL W.
Introduction Of Linked List

Introduction Of Linked List




                     info     Link
Introduction Of Linked List

        Introduction Of Linked List
The pointer variable AVAIL contains the address of the top
node in the stack. The address of the next available node
is to be stored in the variable NEW.

If a node is available then the new top most element of the
stack is denoted by LINK(AVAIL). The fields of the node
corresponding to the pointer value of NEW can now be
filled in and the field LINK(NEW) is set to a value which
designates the successor node of this new node.
Introduction Of Linked List
A similar procedure can be formulated for the
return of a discarded node to the availability
stack. If the address of this discarded node is
given by the variable FREE, then the link field
of this node is set to the present value of
AVAIL and the value of FREE becomes the
new value of AVAIL.

We can now formulate an algorithm which
inserts a node into a linked linear list in a
stack like manner.
Algorithms of Linked List


   Algorithms
  →   Insert at first in single linked list
  →   Insert at Last in single linked list
  →   Insert at Order in single linked list
  →   Delete in single linked list
  →   Copy in single linked list
Insert at first in single linked

              Insert at first in single linked list


INSERT(X,FIRST)

    Where X is a new element and FIRST, a pointer to the first element
of a linked linear list whose typical node contains INFO and LINK fields
as previously described, this function insert X. AVAIL is a pointer to the
top element of the availability stack; NEW is a temporary pointer
variable. It is required that X precede the node whose address is given
to the FIRST.
INSERT(X,FIRST) linked list

              Insert at first in single linked list
Step 1: [Underflow?]
         if AVAIL= NULL
         Then write (“Availability stack underflow”)
                 return (FIRST)

               Step 2: [Obtain address of next free node]
                      NEW ←AVAIL
Step 3: [Remove free node from availability
node]
        AVAIL ← Step 4: [Initialize fields node from availability
                LINK(AVAIL)
                  stack]
                       INFO(NEW) ← X
                       LINK(NEW) ← FIRST
Step 5: [Return address of new node]
        Return(NEW)
INSERT_LAST(X,FIRST)


             Insert at Last in single linked list

INSERT_LAST(X,FIRST)

          Where X is a new element and FIRST, a pointer to the first
element of a linked linear list whose typical node contains INFO and
LINK fields as previously described, this function insert X. AVAIL is a
pointer to the top element of the availability stack; NEW & SAVE are
temporary pointer variable. It is required that X be inserted at the end of
the list.
INSERT_LAST(X,FIRST)


 Insert at Last in single linked list
Step 1: [Underflow?]
         if AVAIL= NULL
         then write (“Availability stack underflow”)
                  return (FIRST)

Step 2: [Obtain address of next free node]
         NEW ← AVAIL

Step 3: [Remove free node from availability node]
         AVAIL ← LINK(AVAIL)

Step 4: [Initialize fields node from availability stack]
          INFO(NEW) ← X
          LINK(NEW) ← NULL
INSERT_LAST(X,FIRST)


 Insert at Last in single linked list
Step 5: [Is the list EMPTY?]
          if FIRST= NULL
          then Return(NEW)

Step 6: [Initiate search for the last node]
          SAVE ← FIRST

Step 7 : [Search for end of list]
          Repeat while LINK(SAVE) ≠ NULL
          SAVE ← LINK(SAVE)

Step 8 : [Set LINK Field of last node to NEW]
          LINK(SAVE) ← NEW

Step 9: [Return first node]
         Return(FIRST)
INSERT_ORD(X,FIRST)

             Insert at Order in single linked list




INSERT_ORD(X,FIRST)

             Where X is a new element and FIRST, a pointer to the first
element of a linked linear list whose typical node contains INFO and
LINK fields as previously described, AVAIL is a pointer to the top
element of the availability stack; NEW & SAVE are temporary pointer
variable. It is required that X be inserted so that it preserves the ordering
of the terms in increasing order of their INFO fields.
INSERT_ORD(X,FIRST)

 Insert at Order in single linked list
Step 1: [Underflow?]
         if AVAIL= NULL
         then write (“Availability stack underflow”)
         return (FIRST)

Step 2: [Obtain address of next free node]
         NEW ← AVAIL

Step 3: [Remove free node from availability node]
         AVAIL ← LINK(AVAIL)

Step 4: [Copy information contents into new node]
         INFO(NEW) ← X

Step 5: [Is the list EMPTY?]
          if FIRST= NULL
          then Return(NEW)
INSERT_ORD(X,FIRST)

             Insert at Order in single linked list
Step 6: [Does the new node precede all others in the list?]
         if INFO(NEW) ≤ INFO(FIRST)
         then LINK(NEW) ← FIRST
         Return(NEW)

Step 7 : [Initialize temporary pointer]
          SAVE ← FIRST

Step 8 : [Search for predecessor of new node]
          Repeat while LINK(SAVE) ≠ NULL and INFO(LINK(SAVE)) ≤ INFO (NEW)
          SAVE ← LINK(SAVE)

Step 9 : [Set LINK Field of new node and its predecessor]
          LINK(NEW) ← LINK(SAVE)
          LINK(SAVE) ← NEW

Step 10: [Return first node]
         Return(FIRST)
DELETE(X,FIRST)

Delete in single linked list


       Where X and FIRST, pointer Variable
whose values denote the address of a node
in linked list and the address of the first
node in the linked list, respectively, this
procedure deletes the node whose address
is given by X. TEMP is used to find the
desired node, and PRED keeps track of the
predecessor of TEMP. note that FIRST is
changed only when X is the first elements
of the list.
DELETE(X,FIRST)

Delete in single linked list
Step 1: [EMPTY LIST?]
          if FIRST= NULL
          then write (“Underflow”)
          return

Step 2: [Initialize search for X]
          TEMP ← FIRST

Step 3: [Find X]
         Repeat thru Step 5 while TEMP ≠ x and
         LINK(TEMP) ≠ NULL

Step 4: [Update Predecessor Marker ]
         PRED ← TEMP

Step 5: [Move to next node]
         TEMP ← LINK(TEMP)
DELETE(X,FIRST)

Delete in single linked list
Step 6: [End of the list?]
         if TEMP ≠ X
         then write(„NODE NOT FOUND”)
         return

Step 7: [Delete X]
         if X = FIRST (is X the First NODE?)
         then FIRST ← LINK(FIRST)
         else LINK(PRED) ← LINK(X)

Step 8 : [Return node to availability area]
          LINK(X) ← AVAIL
          AVAIL ← X
          return
COPY(FIRST)

 Copy in single linked list

         Given FIRST, a pointer to the first
node in the linked list, this function makes a
copy of this list. A typical node in the given
list consists of INFO and LINK fields. The new
list is to contain nodes whose information
and pointer fields are denoted by FIELD and
PTR, respectively. The address of the first
node in the newly created list is to be placed
in BEGIN. NEW,SAVE and PRED are pointer
variable.
COPY(FIRST)

 Copy in single linked list
Step 1: [EMPTY LIST?]
         if FIRST= NULL
         then write (“Underflow”)
                   return

Step 2: [Copy first node]
         if AVAIL = NULL
         then write(„Availability Stack UNDERFLOW‟)
         return(0)
                   else NEW ← AVAIL
                   AVAIL ← LINK(AVAIL)
                   FIELD(NEW) ← INFO(FIRST)
                   BEGIN ← NEW

Step 3: [Initialize traversal]
SAVE ← FIRST
COPY(FIRST)

Copy in single linked list
Step 4: [Move to next node if not at the end of list]
         Repeat through step 6 while LINK(SAVE) ≠ NULL

Step 5: [Update Predecessor and save pointers ]
         PRED ← NEW
         SAVE ← LINK(SAVE)

Step 6: [Copy Node]
         if AVAIL = NULL
         then write(„Availability Stack UNDERFLOW‟)
         return(0)
                  else NEW ← AVAIL
                  AVAIL ← LINK(AVAIL)
                  FIELD(NEW) ← INFO(SAVE)
                  PTR(PRED) ← NEW
COPY(FIRST)

Copy in single linked list
Step 7 : [Set Link of last node and return]
          PTR(NEW) ← NULL
          Return NULL
          return
Linear Linked List MCQ PPT
Linear Linked List MCQ PPT

1)A linear Structure in which the individual elements are joined together by
references to other elements in the structure is known as a_________
•Tree (b) Vector (c) Linked list (d) Table

2)A list that restricts insertions and removals to the front ( or top ) is known as a
(b) Linked list (b) stack (c) queue (d) frontal List

3)To Access an item in a singly linked list you must usa a _______ algorithm.
(b) Traversal (b) access (c) removal (d) insertion

4)Linked lists are collections of data items “lined up in row”-insertions and deletion can be made
     only at the front and the back of a linked list.
(b) TRUE (b) FALSE


5)Self-referential objects can be linked together to from useful data structures such as
     lists,queues,stacks and tree
(a) TRUE (b) FALSE
Linear Linked List MCQ PPT

6)The situation when in a linked list START=NULL is
(a) Underflow (b) overflow (c) housefull (d) saturated

7)The link field in the last node of the linked list contains
(a) NULL (b) link to the first node (c) pointer to the next element (d) Zero value
8)To delete a node at the beginning of the list, the location of the list is modified as the
     address of the.
(a) Second element in the list (b)First element in the list (c) Last element in the list.

9) In the linked list representation of the stacks, the top of the stack is represented by
(a)The last node (b) Any of the nodes (c) First node


10) A linked list in which the last node points to the first is called a
(a) Doubly linked list (b) Circular list (c) Generalized list
THANK
 YOU

More Related Content

What's hot

Link List
Link ListLink List
Link List
umiekalsum
 
Link list presentation slide(Daffodil international university)
Link list presentation slide(Daffodil international university)Link list presentation slide(Daffodil international university)
Link list presentation slide(Daffodil international university)
shah alom
 
Linked lists in Data Structure
Linked lists in Data StructureLinked lists in Data Structure
Linked lists in Data Structure
Muhazzab Chouhadry
 
Doubly & Circular Linked Lists
Doubly & Circular Linked ListsDoubly & Circular Linked Lists
Doubly & Circular Linked Lists
Afaq Mansoor Khan
 
Unit ii(dsc++)
Unit ii(dsc++)Unit ii(dsc++)
Unit ii(dsc++)
Durga Devi
 
Linked list
Linked listLinked list
Linked list
Shashank Shetty
 
Linked lists a
Linked lists aLinked lists a
Linked lists a
Khuram Shahzad
 
linked list
linked listlinked list
linked list
Shaista Qadir
 
Circular linked list
Circular linked listCircular linked list
Circular linked list
maamir farooq
 
Linked List Static and Dynamic Memory Allocation
Linked List Static and Dynamic Memory AllocationLinked List Static and Dynamic Memory Allocation
Linked List Static and Dynamic Memory Allocation
Prof Ansari
 
Circular link list.ppt
Circular link list.pptCircular link list.ppt
Circular link list.ppt
Tirthika Bandi
 
Circular linked list
Circular linked listCircular linked list
Circular linked listdchuynh
 
header, circular and two way linked lists
header, circular and two way linked listsheader, circular and two way linked lists
header, circular and two way linked lists
student
 
Singly & Circular Linked list
Singly & Circular Linked listSingly & Circular Linked list
Singly & Circular Linked list
Khulna University of Engineering & Tecnology
 
linked list using c
linked list using clinked list using c
linked list using c
Venkat Reddy
 
Linked lists
Linked listsLinked lists
Linked lists
SARITHA REDDY
 
Linked list
Linked listLinked list
Linked list
Priyanka Rana
 
Array implementation and linked list as datat structure
Array implementation and linked list as datat structureArray implementation and linked list as datat structure
Array implementation and linked list as datat structureTushar Aneyrao
 
linked list (c#)
 linked list (c#) linked list (c#)
linked list (c#)
swajahatr
 

What's hot (19)

Link List
Link ListLink List
Link List
 
Link list presentation slide(Daffodil international university)
Link list presentation slide(Daffodil international university)Link list presentation slide(Daffodil international university)
Link list presentation slide(Daffodil international university)
 
Linked lists in Data Structure
Linked lists in Data StructureLinked lists in Data Structure
Linked lists in Data Structure
 
Doubly & Circular Linked Lists
Doubly & Circular Linked ListsDoubly & Circular Linked Lists
Doubly & Circular Linked Lists
 
Unit ii(dsc++)
Unit ii(dsc++)Unit ii(dsc++)
Unit ii(dsc++)
 
Linked list
Linked listLinked list
Linked list
 
Linked lists a
Linked lists aLinked lists a
Linked lists a
 
linked list
linked listlinked list
linked list
 
Circular linked list
Circular linked listCircular linked list
Circular linked list
 
Linked List Static and Dynamic Memory Allocation
Linked List Static and Dynamic Memory AllocationLinked List Static and Dynamic Memory Allocation
Linked List Static and Dynamic Memory Allocation
 
Circular link list.ppt
Circular link list.pptCircular link list.ppt
Circular link list.ppt
 
Circular linked list
Circular linked listCircular linked list
Circular linked list
 
header, circular and two way linked lists
header, circular and two way linked listsheader, circular and two way linked lists
header, circular and two way linked lists
 
Singly & Circular Linked list
Singly & Circular Linked listSingly & Circular Linked list
Singly & Circular Linked list
 
linked list using c
linked list using clinked list using c
linked list using c
 
Linked lists
Linked listsLinked lists
Linked lists
 
Linked list
Linked listLinked list
Linked list
 
Array implementation and linked list as datat structure
Array implementation and linked list as datat structureArray implementation and linked list as datat structure
Array implementation and linked list as datat structure
 
linked list (c#)
 linked list (c#) linked list (c#)
linked list (c#)
 

Viewers also liked

6. Linked list - Data Structures using C++ by Varsha Patil
6. Linked list - Data Structures using C++ by Varsha Patil6. Linked list - Data Structures using C++ by Varsha Patil
6. Linked list - Data Structures using C++ by Varsha Patil
widespreadpromotion
 
7 Myths of AI
7 Myths of AI7 Myths of AI
7 Myths of AI
CrowdFlower
 
Linked list
Linked listLinked list
Linked list
akshat360
 
358 33 powerpoint-slides_8-linked-lists_chapter-8
358 33 powerpoint-slides_8-linked-lists_chapter-8358 33 powerpoint-slides_8-linked-lists_chapter-8
358 33 powerpoint-slides_8-linked-lists_chapter-8
sumitbardhan
 
Searching and Sorting Techniques in Data Structure
Searching and Sorting Techniques in Data StructureSearching and Sorting Techniques in Data Structure
Searching and Sorting Techniques in Data Structure
Balwant Gorad
 
Linked list
Linked listLinked list
Linked list
Trupti Agrawal
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked list
Fahd Allebdi
 
Trees data structure
Trees data structureTrees data structure
Trees data structure
Sumit Gupta
 
Double linked list
Double linked listDouble linked list
Double linked list
raviahuja11
 
Data structure using c module 1
Data structure using c module 1Data structure using c module 1
Data structure using c module 1
smruti sarangi
 
Individual-In-The-Loop (for Ethically Aligned Artificial Intelligence)
Individual-In-The-Loop (for Ethically Aligned Artificial Intelligence)Individual-In-The-Loop (for Ethically Aligned Artificial Intelligence)
Individual-In-The-Loop (for Ethically Aligned Artificial Intelligence)
John C. Havens
 
Insertion and Deletion in Binary Search Trees (using Arrays and Linked Lists)
Insertion and Deletion in Binary Search Trees (using Arrays and Linked Lists)Insertion and Deletion in Binary Search Trees (using Arrays and Linked Lists)
Insertion and Deletion in Binary Search Trees (using Arrays and Linked Lists)
Lovelyn Rose
 
Cyber Crime
Cyber CrimeCyber Crime
Cyber Crime
Abhishek L.R
 
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
Balwant Gorad
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
Abhishek L.R
 
Open Legal Data Workshop at Stanford
Open Legal Data Workshop at StanfordOpen Legal Data Workshop at Stanford
Open Legal Data Workshop at Stanford
Harry Surden
 
Harry Surden - Artificial Intelligence and Law Overview
Harry Surden - Artificial Intelligence and Law OverviewHarry Surden - Artificial Intelligence and Law Overview
Harry Surden - Artificial Intelligence and Law Overview
Harry Surden
 
AI and Machine Learning Demystified by Carol Smith at Midwest UX 2017
AI and Machine Learning Demystified by Carol Smith at Midwest UX 2017AI and Machine Learning Demystified by Carol Smith at Midwest UX 2017
AI and Machine Learning Demystified by Carol Smith at Midwest UX 2017
Carol Smith
 

Viewers also liked (18)

6. Linked list - Data Structures using C++ by Varsha Patil
6. Linked list - Data Structures using C++ by Varsha Patil6. Linked list - Data Structures using C++ by Varsha Patil
6. Linked list - Data Structures using C++ by Varsha Patil
 
7 Myths of AI
7 Myths of AI7 Myths of AI
7 Myths of AI
 
Linked list
Linked listLinked list
Linked list
 
358 33 powerpoint-slides_8-linked-lists_chapter-8
358 33 powerpoint-slides_8-linked-lists_chapter-8358 33 powerpoint-slides_8-linked-lists_chapter-8
358 33 powerpoint-slides_8-linked-lists_chapter-8
 
Searching and Sorting Techniques in Data Structure
Searching and Sorting Techniques in Data StructureSearching and Sorting Techniques in Data Structure
Searching and Sorting Techniques in Data Structure
 
Linked list
Linked listLinked list
Linked list
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked list
 
Trees data structure
Trees data structureTrees data structure
Trees data structure
 
Double linked list
Double linked listDouble linked list
Double linked list
 
Data structure using c module 1
Data structure using c module 1Data structure using c module 1
Data structure using c module 1
 
Individual-In-The-Loop (for Ethically Aligned Artificial Intelligence)
Individual-In-The-Loop (for Ethically Aligned Artificial Intelligence)Individual-In-The-Loop (for Ethically Aligned Artificial Intelligence)
Individual-In-The-Loop (for Ethically Aligned Artificial Intelligence)
 
Insertion and Deletion in Binary Search Trees (using Arrays and Linked Lists)
Insertion and Deletion in Binary Search Trees (using Arrays and Linked Lists)Insertion and Deletion in Binary Search Trees (using Arrays and Linked Lists)
Insertion and Deletion in Binary Search Trees (using Arrays and Linked Lists)
 
Cyber Crime
Cyber CrimeCyber Crime
Cyber Crime
 
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
Linked List, Types of Linked LIst, Various Operations, Applications of Linked...
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
 
Open Legal Data Workshop at Stanford
Open Legal Data Workshop at StanfordOpen Legal Data Workshop at Stanford
Open Legal Data Workshop at Stanford
 
Harry Surden - Artificial Intelligence and Law Overview
Harry Surden - Artificial Intelligence and Law OverviewHarry Surden - Artificial Intelligence and Law Overview
Harry Surden - Artificial Intelligence and Law Overview
 
AI and Machine Learning Demystified by Carol Smith at Midwest UX 2017
AI and Machine Learning Demystified by Carol Smith at Midwest UX 2017AI and Machine Learning Demystified by Carol Smith at Midwest UX 2017
AI and Machine Learning Demystified by Carol Smith at Midwest UX 2017
 

Similar to linked list

Stack q ll algo
Stack q ll algoStack q ll algo
Stack q ll algo
parthpatel9694
 
linked-list.ppt
linked-list.pptlinked-list.ppt
linked-list.ppt
DikkySuryadiSKomMKom
 
Array linked list.ppt
Array  linked list.pptArray  linked list.ppt
Array linked list.ppt
Waf1231
 
Bsc cs ii dfs u-2 linklist,stack,queue
Bsc cs ii  dfs u-2 linklist,stack,queueBsc cs ii  dfs u-2 linklist,stack,queue
Bsc cs ii dfs u-2 linklist,stack,queue
Rai University
 
Bca ii dfs u-2 linklist,stack,queue
Bca ii  dfs u-2 linklist,stack,queueBca ii  dfs u-2 linklist,stack,queue
Bca ii dfs u-2 linklist,stack,queue
Rai University
 
Mca ii dfs u-3 linklist,stack,queue
Mca ii dfs u-3 linklist,stack,queueMca ii dfs u-3 linklist,stack,queue
Mca ii dfs u-3 linklist,stack,queue
Rai University
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
JAGDEEPKUMAR23
 
Data Structures in C++I am really new to C++, so links are really .pdf
Data Structures in C++I am really new to C++, so links are really .pdfData Structures in C++I am really new to C++, so links are really .pdf
Data Structures in C++I am really new to C++, so links are really .pdf
rohit219406
 
Linked list
Linked list Linked list
Linked list
Arbind Mandal
 
Unit 2 linked list and queues
Unit 2   linked list and queuesUnit 2   linked list and queues
Unit 2 linked list and queues
kalyanineve
 
3.ppt
3.ppt3.ppt
Data Structure Lecture 7
Data Structure Lecture 7Data Structure Lecture 7
Data Structure Lecture 7Teksify
 
Lec-4_Linked-List (1).pdf
Lec-4_Linked-List (1).pdfLec-4_Linked-List (1).pdf
Lec-4_Linked-List (1).pdf
KylaMaeGarcia1
 
ds 4Linked lists.ppt
ds 4Linked lists.pptds 4Linked lists.ppt
ds 4Linked lists.ppt
AlliVinay1
 
List Data Structure
List Data StructureList Data Structure
List Data Structure
Zidny Nafan
 

Similar to linked list (20)

Stack q ll algo
Stack q ll algoStack q ll algo
Stack q ll algo
 
Algo>ADT list & linked list
Algo>ADT list & linked listAlgo>ADT list & linked list
Algo>ADT list & linked list
 
linked-list.ppt
linked-list.pptlinked-list.ppt
linked-list.ppt
 
Array linked list.ppt
Array  linked list.pptArray  linked list.ppt
Array linked list.ppt
 
Bsc cs ii dfs u-2 linklist,stack,queue
Bsc cs ii  dfs u-2 linklist,stack,queueBsc cs ii  dfs u-2 linklist,stack,queue
Bsc cs ii dfs u-2 linklist,stack,queue
 
List
ListList
List
 
Bca ii dfs u-2 linklist,stack,queue
Bca ii  dfs u-2 linklist,stack,queueBca ii  dfs u-2 linklist,stack,queue
Bca ii dfs u-2 linklist,stack,queue
 
Mca ii dfs u-3 linklist,stack,queue
Mca ii dfs u-3 linklist,stack,queueMca ii dfs u-3 linklist,stack,queue
Mca ii dfs u-3 linklist,stack,queue
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Data Structures in C++I am really new to C++, so links are really .pdf
Data Structures in C++I am really new to C++, so links are really .pdfData Structures in C++I am really new to C++, so links are really .pdf
Data Structures in C++I am really new to C++, so links are really .pdf
 
Linked list
Linked list Linked list
Linked list
 
Unit 2 linked list and queues
Unit 2   linked list and queuesUnit 2   linked list and queues
Unit 2 linked list and queues
 
3.ppt
3.ppt3.ppt
3.ppt
 
3.ppt
3.ppt3.ppt
3.ppt
 
Data structures2
Data structures2Data structures2
Data structures2
 
Data Structure Lecture 7
Data Structure Lecture 7Data Structure Lecture 7
Data Structure Lecture 7
 
Lec-4_Linked-List (1).pdf
Lec-4_Linked-List (1).pdfLec-4_Linked-List (1).pdf
Lec-4_Linked-List (1).pdf
 
ds 4Linked lists.ppt
ds 4Linked lists.pptds 4Linked lists.ppt
ds 4Linked lists.ppt
 
List Data Structure
List Data StructureList Data Structure
List Data Structure
 
List data structure
List data structure List data structure
List data structure
 

Recently uploaded

Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
Nguyen Thanh Tu Collection
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 

Recently uploaded (20)

Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 

linked list

  • 1. Dgroup@mca.com ************ Presentation ON BY D Group
  • 2. Member of D group Privanka Dabhai Insert at first in single linked list Praful Aparnathi Insert at Last in single linked list Arpan Shah Insert at Order in single linked list Narendra Chauhan Delete in single linked list Ram Sanjay Copy in single linked list Rushabh Bhavsar MCQ Bhavisha Purohit
  • 3. Index Of Linear Linked List INDEX 1.Introduction 2.Algorithms 3.MCQ
  • 4. Introduction Of Linked List Introduction Of Linked List This subsection describes in detail the representation of linear lists using linked allocation. Algorithms such as the insertion of nodes and the deletion of nodes from a linked linear list are given. The programming aspects of linked allocation are discussed both from the simulation point of view, using arrays, and from the programmer defined data type facility available in pascal.
  • 5. Introduction Of Linked List Introduction Of Linked List The first approach is the one which is usually taken in programming linked represented structures in languages that do not have pointer or link facilities, such as FORTRAN,ALGOL 60 and BASIC, while the second approach is used in languages that do have pointer facilities, such as Pascal, PL/ISNOBOL,ALGOL 68 and ALGOL W.
  • 6. Introduction Of Linked List Introduction Of Linked List info Link
  • 7. Introduction Of Linked List Introduction Of Linked List The pointer variable AVAIL contains the address of the top node in the stack. The address of the next available node is to be stored in the variable NEW. If a node is available then the new top most element of the stack is denoted by LINK(AVAIL). The fields of the node corresponding to the pointer value of NEW can now be filled in and the field LINK(NEW) is set to a value which designates the successor node of this new node.
  • 8. Introduction Of Linked List A similar procedure can be formulated for the return of a discarded node to the availability stack. If the address of this discarded node is given by the variable FREE, then the link field of this node is set to the present value of AVAIL and the value of FREE becomes the new value of AVAIL. We can now formulate an algorithm which inserts a node into a linked linear list in a stack like manner.
  • 9. Algorithms of Linked List Algorithms → Insert at first in single linked list → Insert at Last in single linked list → Insert at Order in single linked list → Delete in single linked list → Copy in single linked list
  • 10. Insert at first in single linked Insert at first in single linked list INSERT(X,FIRST) Where X is a new element and FIRST, a pointer to the first element of a linked linear list whose typical node contains INFO and LINK fields as previously described, this function insert X. AVAIL is a pointer to the top element of the availability stack; NEW is a temporary pointer variable. It is required that X precede the node whose address is given to the FIRST.
  • 11. INSERT(X,FIRST) linked list Insert at first in single linked list Step 1: [Underflow?] if AVAIL= NULL Then write (“Availability stack underflow”) return (FIRST) Step 2: [Obtain address of next free node] NEW ←AVAIL Step 3: [Remove free node from availability node] AVAIL ← Step 4: [Initialize fields node from availability LINK(AVAIL) stack] INFO(NEW) ← X LINK(NEW) ← FIRST Step 5: [Return address of new node] Return(NEW)
  • 12. INSERT_LAST(X,FIRST) Insert at Last in single linked list INSERT_LAST(X,FIRST) Where X is a new element and FIRST, a pointer to the first element of a linked linear list whose typical node contains INFO and LINK fields as previously described, this function insert X. AVAIL is a pointer to the top element of the availability stack; NEW & SAVE are temporary pointer variable. It is required that X be inserted at the end of the list.
  • 13. INSERT_LAST(X,FIRST) Insert at Last in single linked list Step 1: [Underflow?] if AVAIL= NULL then write (“Availability stack underflow”) return (FIRST) Step 2: [Obtain address of next free node] NEW ← AVAIL Step 3: [Remove free node from availability node] AVAIL ← LINK(AVAIL) Step 4: [Initialize fields node from availability stack] INFO(NEW) ← X LINK(NEW) ← NULL
  • 14. INSERT_LAST(X,FIRST) Insert at Last in single linked list Step 5: [Is the list EMPTY?] if FIRST= NULL then Return(NEW) Step 6: [Initiate search for the last node] SAVE ← FIRST Step 7 : [Search for end of list] Repeat while LINK(SAVE) ≠ NULL SAVE ← LINK(SAVE) Step 8 : [Set LINK Field of last node to NEW] LINK(SAVE) ← NEW Step 9: [Return first node] Return(FIRST)
  • 15. INSERT_ORD(X,FIRST) Insert at Order in single linked list INSERT_ORD(X,FIRST) Where X is a new element and FIRST, a pointer to the first element of a linked linear list whose typical node contains INFO and LINK fields as previously described, AVAIL is a pointer to the top element of the availability stack; NEW & SAVE are temporary pointer variable. It is required that X be inserted so that it preserves the ordering of the terms in increasing order of their INFO fields.
  • 16. INSERT_ORD(X,FIRST) Insert at Order in single linked list Step 1: [Underflow?] if AVAIL= NULL then write (“Availability stack underflow”) return (FIRST) Step 2: [Obtain address of next free node] NEW ← AVAIL Step 3: [Remove free node from availability node] AVAIL ← LINK(AVAIL) Step 4: [Copy information contents into new node] INFO(NEW) ← X Step 5: [Is the list EMPTY?] if FIRST= NULL then Return(NEW)
  • 17. INSERT_ORD(X,FIRST) Insert at Order in single linked list Step 6: [Does the new node precede all others in the list?] if INFO(NEW) ≤ INFO(FIRST) then LINK(NEW) ← FIRST Return(NEW) Step 7 : [Initialize temporary pointer] SAVE ← FIRST Step 8 : [Search for predecessor of new node] Repeat while LINK(SAVE) ≠ NULL and INFO(LINK(SAVE)) ≤ INFO (NEW) SAVE ← LINK(SAVE) Step 9 : [Set LINK Field of new node and its predecessor] LINK(NEW) ← LINK(SAVE) LINK(SAVE) ← NEW Step 10: [Return first node] Return(FIRST)
  • 18. DELETE(X,FIRST) Delete in single linked list Where X and FIRST, pointer Variable whose values denote the address of a node in linked list and the address of the first node in the linked list, respectively, this procedure deletes the node whose address is given by X. TEMP is used to find the desired node, and PRED keeps track of the predecessor of TEMP. note that FIRST is changed only when X is the first elements of the list.
  • 19. DELETE(X,FIRST) Delete in single linked list Step 1: [EMPTY LIST?] if FIRST= NULL then write (“Underflow”) return Step 2: [Initialize search for X] TEMP ← FIRST Step 3: [Find X] Repeat thru Step 5 while TEMP ≠ x and LINK(TEMP) ≠ NULL Step 4: [Update Predecessor Marker ] PRED ← TEMP Step 5: [Move to next node] TEMP ← LINK(TEMP)
  • 20. DELETE(X,FIRST) Delete in single linked list Step 6: [End of the list?] if TEMP ≠ X then write(„NODE NOT FOUND”) return Step 7: [Delete X] if X = FIRST (is X the First NODE?) then FIRST ← LINK(FIRST) else LINK(PRED) ← LINK(X) Step 8 : [Return node to availability area] LINK(X) ← AVAIL AVAIL ← X return
  • 21. COPY(FIRST) Copy in single linked list Given FIRST, a pointer to the first node in the linked list, this function makes a copy of this list. A typical node in the given list consists of INFO and LINK fields. The new list is to contain nodes whose information and pointer fields are denoted by FIELD and PTR, respectively. The address of the first node in the newly created list is to be placed in BEGIN. NEW,SAVE and PRED are pointer variable.
  • 22. COPY(FIRST) Copy in single linked list Step 1: [EMPTY LIST?] if FIRST= NULL then write (“Underflow”) return Step 2: [Copy first node] if AVAIL = NULL then write(„Availability Stack UNDERFLOW‟) return(0) else NEW ← AVAIL AVAIL ← LINK(AVAIL) FIELD(NEW) ← INFO(FIRST) BEGIN ← NEW Step 3: [Initialize traversal] SAVE ← FIRST
  • 23. COPY(FIRST) Copy in single linked list Step 4: [Move to next node if not at the end of list] Repeat through step 6 while LINK(SAVE) ≠ NULL Step 5: [Update Predecessor and save pointers ] PRED ← NEW SAVE ← LINK(SAVE) Step 6: [Copy Node] if AVAIL = NULL then write(„Availability Stack UNDERFLOW‟) return(0) else NEW ← AVAIL AVAIL ← LINK(AVAIL) FIELD(NEW) ← INFO(SAVE) PTR(PRED) ← NEW
  • 24. COPY(FIRST) Copy in single linked list Step 7 : [Set Link of last node and return] PTR(NEW) ← NULL Return NULL return
  • 26. Linear Linked List MCQ PPT 1)A linear Structure in which the individual elements are joined together by references to other elements in the structure is known as a_________ •Tree (b) Vector (c) Linked list (d) Table 2)A list that restricts insertions and removals to the front ( or top ) is known as a (b) Linked list (b) stack (c) queue (d) frontal List 3)To Access an item in a singly linked list you must usa a _______ algorithm. (b) Traversal (b) access (c) removal (d) insertion 4)Linked lists are collections of data items “lined up in row”-insertions and deletion can be made only at the front and the back of a linked list. (b) TRUE (b) FALSE 5)Self-referential objects can be linked together to from useful data structures such as lists,queues,stacks and tree (a) TRUE (b) FALSE
  • 27. Linear Linked List MCQ PPT 6)The situation when in a linked list START=NULL is (a) Underflow (b) overflow (c) housefull (d) saturated 7)The link field in the last node of the linked list contains (a) NULL (b) link to the first node (c) pointer to the next element (d) Zero value 8)To delete a node at the beginning of the list, the location of the list is modified as the address of the. (a) Second element in the list (b)First element in the list (c) Last element in the list. 9) In the linked list representation of the stacks, the top of the stack is represented by (a)The last node (b) Any of the nodes (c) First node 10) A linked list in which the last node points to the first is called a (a) Doubly linked list (b) Circular list (c) Generalized list