SlideShare une entreprise Scribd logo
1  sur  89
 
Chapter 13 Pointers and Linked Lists
Overview ,[object Object],[object Object],Slide 13-
13.1 Nodes and Linked Lists
Nodes and Linked Lists ,[object Object],[object Object],[object Object],[object Object],Slide 13-  10 12 14 end head
Nodes ,[object Object],[object Object],[object Object],[object Object],Slide 13-  Display 13.1
Implementing Nodes ,[object Object],[object Object],Slide 13-  This circular definition  is allowed in C++
The head of a List ,[object Object],[object Object],Slide 13-
Accessing Items in a Node ,[object Object],[object Object],[object Object],Slide 13-
The Arrow Operator ,[object Object],[object Object],[object Object],Slide 13-  Display 13.2
NULL ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Slide 13-
To Use NULL ,[object Object],[object Object],Slide 13-
Linked Lists ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Slide 13-
Building a Linked List: The node definition ,[object Object],Slide 13-
Building a Linked List: Declaring Pointer Variable head ,[object Object],[object Object],Slide 13-
Building a Linked List: Creating the First Node ,[object Object],[object Object],Slide 13-
Building a Linked List: Initializing the Node ,[object Object],[object Object],Slide 13-
Function head_insert ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Slide 13-
Pseudocode for head_insert ,[object Object],[object Object],[object Object],[object Object],Slide 13-  Display 13.3
Translating head_insert to C++ ,[object Object],[object Object],[object Object],[object Object],Slide 13-  Display 13.4
An Empty List ,[object Object],[object Object],[object Object],[object Object],Slide 13-
Losing Nodes ,[object Object],[object Object],[object Object],Slide 13-  Display 13.5
Memory Leaks ,[object Object],[object Object],[object Object],[object Object],Slide 13-
Searching a Linked List ,[object Object],[object Object],[object Object],[object Object],[object Object],Slide 13-
Function search ,[object Object],[object Object],[object Object],[object Object],Slide 13-  Display 13.6
Pseudocode for search ,[object Object],[object Object],[object Object],Slide 13-
Moving Through the List ,[object Object],[object Object],[object Object],[object Object],Slide 13-
A Refinement of search ,[object Object],Slide 13-  Check for last node
Searching an Empty List ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Slide 13-  Display 13.7
Pointers as Iterators ,[object Object],[object Object],[object Object],[object Object],Slide 13-
Iterator Example ,[object Object],Slide 13-
Inserting a Node Inside a List ,[object Object],[object Object],[object Object],[object Object],Slide 13-  Display 13.8
Inserting the New Node ,[object Object],[object Object],[object Object],Slide 13-
Inserting the New Node ,[object Object],Slide 13-  head after_me temp_ptr 2 2 3 2 7 2 9 0 5 2
Caution! ,[object Object],[object Object],[object Object],Slide 13-  Display 13.9
Function insert Again ,[object Object],[object Object],[object Object],[object Object],Slide 13-
Removing a Node ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Slide 13-  Display 13.10
Assignment With Pointers ,[object Object],[object Object],[object Object],Slide 13-
Variations on Linked Lists ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Slide 13-  Display 13.11
Binary Tree ,[object Object],[object Object],[object Object],Slide 13-  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Display 13.12
Linked List of Classes ,[object Object],[object Object],[object Object],Slide 13-  Display 13.13 Display 13.14 (1-2)
Program using the Node class ,[object Object],Slide 13-  Display 13.15 (1-3)
Section 13.1 Conclusion ,[object Object],[object Object],[object Object],Slide 13-
13.2 Stacks and Queues
A Linked List Application ,[object Object],[object Object],[object Object],Slide 13-  Display 13.16
Program Example: A Stack Class ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Slide 13-  Display 13.17
Using the stack Class ,[object Object],Slide 13-  Display 13.18 (1-2)
Function push ,[object Object],[object Object],[object Object],[object Object],Slide 13-
Function pop ,[object Object],[object Object],[object Object],[object Object],[object Object],Slide 13-
Empty Stack ,[object Object],Slide 13-
The Copy Constructor ,[object Object],[object Object],[object Object],Slide 13-
The stack destructor ,[object Object],Slide 13-
stack Class Implementation ,[object Object],Slide 13-  Display 13.19 (1) Display 13.19 (2)
A Queue ,[object Object],[object Object],[object Object],Slide 13-  Display 13.20
Queue Class Implementation ,[object Object],[object Object],[object Object],[object Object],Slide 13-  Display 13.21 (1-2) Display 13.22 (1-2) Display 13.23 (1-3)
Section 13.2 Conclusion ,[object Object],[object Object],[object Object],[object Object],Slide 13-
Chapter 13 -- End Slide 13-
Display 13.1  Slide 13-  Back Next
Display 13.2 Slide 13-  Back Next
Display 13.3 Slide 13-  Back Next
Display 13.4 Slide 13-  Back Next
Display 13.5 Slide 13-  Back Next
Display 13.6 Slide 13-  Back Next
Display 13.7 Slide 13-  Back Next
Display 13.8 Slide 13-  Next Back
Display 13.9 Slide 13-  Back Next
Display 13.10 Slide 13-  Next Back
Display 13.11 Slide 13-  Back Next
Display 13.12 Slide 13-  Back Next
Display 13.13 Slide 13-  Next Back
Display 13.14 (1/2) Slide 13-  Back Next
Display 13.14 (2/2) Slide 13-  Next Back
Display 13.15 (1/3) Slide 13-  Back Next
Display 13.15 (2/3)  Slide 13-  Next Back
Display 13.15 (3/3) Slide 13-  Back Next
Display 13.16 Slide 13-  Back Next
Display 13.17 Slide 13-  Back Next
Display 13.18 (1/2) Slide 13-  Back Next
Display 13.18 (2/2) Slide 13-  Back Next
Display 13.19 (1/2) Slide 13-  Back Next
Display 13.19 (2/2) Slide 13-  Back Next
Display 13.20 Slide 13-  Back Next
Display 13.21 (1/2) Slide 13-  Back Next
Display 13.21 (2/2) Slide 13-  Back Next
Display 13.22 (1/2) Slide 13-  Back Next
Display 13.22 (2/2) Slide 13-  Back Next
Display 13.23 (1/3) Slide 13-  Back Next
Display 13.23 (2/3) Slide 13-  Back Next
Display 13.23 (3/3) Slide 13-  Back Next

Contenu connexe

Tendances

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
 
Circular linked list
Circular linked listCircular linked list
Circular linked list
dchuynh
 
Linked list
Linked listLinked list
Linked list
VONI
 
Notes fp201-pointer notes
Notes fp201-pointer notesNotes fp201-pointer notes
Notes fp201-pointer notes
Siti Nadirah
 

Tendances (20)

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
 
Circular linked list
Circular linked listCircular linked list
Circular linked list
 
linked list
linked list linked list
linked list
 
Circular linked list
Circular linked listCircular linked list
Circular linked list
 
Linked lists a
Linked lists aLinked lists a
Linked lists a
 
Linklist
LinklistLinklist
Linklist
 
Linked list
Linked listLinked list
Linked list
 
Pointers in c++
Pointers in c++Pointers in c++
Pointers in c++
 
CSE240 Doubly Linked Lists
CSE240 Doubly Linked ListsCSE240 Doubly Linked Lists
CSE240 Doubly Linked Lists
 
Unit ii(dsc++)
Unit ii(dsc++)Unit ii(dsc++)
Unit ii(dsc++)
 
Fundamentals of Pointers in C
Fundamentals of Pointers in CFundamentals of Pointers in C
Fundamentals of Pointers in C
 
Linked List
Linked ListLinked List
Linked List
 
Data Structure (Dynamic Array and Linked List)
Data Structure (Dynamic Array and Linked List)Data Structure (Dynamic Array and Linked List)
Data Structure (Dynamic Array and Linked List)
 
Notes fp201-pointer notes
Notes fp201-pointer notesNotes fp201-pointer notes
Notes fp201-pointer notes
 
Linked list
Linked listLinked list
Linked list
 
Arrays in c++
Arrays in c++Arrays in c++
Arrays in c++
 
STACK, LINKED LIST ,AND QUEUE
STACK, LINKED LIST ,AND QUEUESTACK, LINKED LIST ,AND QUEUE
STACK, LINKED LIST ,AND QUEUE
 
Linked list
Linked listLinked list
Linked list
 
computer notes - Linked list
computer notes - Linked listcomputer notes - Linked list
computer notes - Linked list
 
Computer Science Assignment Help
 Computer Science Assignment Help  Computer Science Assignment Help
Computer Science Assignment Help
 

Similaire à Savitch ch 13

Mi 103 linked list
Mi 103 linked listMi 103 linked list
Mi 103 linked list
Amit Vats
 
Lec3-Linked list.pptx
Lec3-Linked list.pptxLec3-Linked list.pptx
Lec3-Linked list.pptx
FaheemMahmood2
 

Similaire à Savitch ch 13 (20)

linkedlistwith animations.ppt
linkedlistwith animations.pptlinkedlistwith animations.ppt
linkedlistwith animations.ppt
 
Linked List.pptx
Linked List.pptxLinked List.pptx
Linked List.pptx
 
Mi 103 linked list
Mi 103 linked listMi 103 linked list
Mi 103 linked list
 
Data Structures_Linked List
Data Structures_Linked ListData Structures_Linked List
Data Structures_Linked List
 
Link list part 1
Link list part 1Link list part 1
Link list part 1
 
Algo>ADT list & linked list
Algo>ADT list & linked listAlgo>ADT list & linked list
Algo>ADT list & linked list
 
DS_LinkedList.pptx
DS_LinkedList.pptxDS_LinkedList.pptx
DS_LinkedList.pptx
 
17 linkedlist (1)
17 linkedlist (1)17 linkedlist (1)
17 linkedlist (1)
 
Ch17
Ch17Ch17
Ch17
 
Array linked list.ppt
Array  linked list.pptArray  linked list.ppt
Array linked list.ppt
 
List
ListList
List
 
Linked list
Linked list Linked list
Linked list
 
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...
 
Linkedlist
LinkedlistLinkedlist
Linkedlist
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Lec-4_Linked-List (1).pdf
Lec-4_Linked-List (1).pdfLec-4_Linked-List (1).pdf
Lec-4_Linked-List (1).pdf
 
Lec3-Linked list.pptx
Lec3-Linked list.pptxLec3-Linked list.pptx
Lec3-Linked list.pptx
 
Linked List
Linked ListLinked List
Linked List
 
Linked list
Linked listLinked list
Linked list
 
Linked list1.ppt
Linked list1.pptLinked list1.ppt
Linked list1.ppt
 

Plus de Terry Yoast

Plus de Terry Yoast (20)

9781305078444 ppt ch12
9781305078444 ppt ch129781305078444 ppt ch12
9781305078444 ppt ch12
 
9781305078444 ppt ch11
9781305078444 ppt ch119781305078444 ppt ch11
9781305078444 ppt ch11
 
9781305078444 ppt ch10
9781305078444 ppt ch109781305078444 ppt ch10
9781305078444 ppt ch10
 
9781305078444 ppt ch09
9781305078444 ppt ch099781305078444 ppt ch09
9781305078444 ppt ch09
 
9781305078444 ppt ch08
9781305078444 ppt ch089781305078444 ppt ch08
9781305078444 ppt ch08
 
9781305078444 ppt ch07
9781305078444 ppt ch079781305078444 ppt ch07
9781305078444 ppt ch07
 
9781305078444 ppt ch06
9781305078444 ppt ch069781305078444 ppt ch06
9781305078444 ppt ch06
 
9781305078444 ppt ch05
9781305078444 ppt ch059781305078444 ppt ch05
9781305078444 ppt ch05
 
9781305078444 ppt ch04
9781305078444 ppt ch049781305078444 ppt ch04
9781305078444 ppt ch04
 
9781305078444 ppt ch03
9781305078444 ppt ch039781305078444 ppt ch03
9781305078444 ppt ch03
 
9781305078444 ppt ch02
9781305078444 ppt ch029781305078444 ppt ch02
9781305078444 ppt ch02
 
9781305078444 ppt ch01
9781305078444 ppt ch019781305078444 ppt ch01
9781305078444 ppt ch01
 
9781337102087 ppt ch13
9781337102087 ppt ch139781337102087 ppt ch13
9781337102087 ppt ch13
 
9781337102087 ppt ch18
9781337102087 ppt ch189781337102087 ppt ch18
9781337102087 ppt ch18
 
9781337102087 ppt ch17
9781337102087 ppt ch179781337102087 ppt ch17
9781337102087 ppt ch17
 
9781337102087 ppt ch16
9781337102087 ppt ch169781337102087 ppt ch16
9781337102087 ppt ch16
 
9781337102087 ppt ch15
9781337102087 ppt ch159781337102087 ppt ch15
9781337102087 ppt ch15
 
9781337102087 ppt ch14
9781337102087 ppt ch149781337102087 ppt ch14
9781337102087 ppt ch14
 
9781337102087 ppt ch12
9781337102087 ppt ch129781337102087 ppt ch12
9781337102087 ppt ch12
 
9781337102087 ppt ch11
9781337102087 ppt ch119781337102087 ppt ch11
9781337102087 ppt ch11
 

Dernier

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 

Dernier (20)

Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 

Savitch ch 13