SlideShare ist ein Scribd-Unternehmen logo
1 von 56
 
 
List data structure ,[object Object],[object Object],[object Object],[object Object],[object Object]
List data structure ,[object Object],[object Object]
Operations a programmer performs with a list data structure. Operation Name Description createList() Create a new list (presumably empty) copy() Set one list to be a copy of another clear();  Clear a list (remove all elements) insert(X, ?) Insert element X at a  particular position  in the list remove(?) Remove element at some position in the list get(?) Get element at a given position update(X, ?) Replace the element at a given position with X find(X) Determine if the element X is in the list length() Returns the length of the list.
List Data Structure ,[object Object],[object Object],[object Object],[object Object],[object Object]
List Data Structure ,[object Object],Functions Description start() Moves the “current” pointer to the very first element tail() Moves the “current” pointer to the very last element next() Move the current position forward one element back() Move the current position backward one element
List Implementation ,[object Object],[object Object],[object Object],A  2 6 8 7 1 current size Index 1 2 3 4 5 3 5
add Method ,[object Object],[object Object],[object Object],[object Object],[object Object],A  2 6 8 7 1 current size Index 1 2 3 4 5 4 5 A  2 6 8 9 7 1 current size Index 1 2 3 4 5 6 4 6
next Method ,[object Object],[object Object],[object Object]
remove Method ,[object Object],[object Object],[object Object],A  2 6 8 9 1 current size Index 1 2 3 4 5 6 5 6 5 A  2 6 8 9 1 current size Index 1 2 3 4 5 5 5
find Method ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Other Methods ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Analysis of Array List ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
 
List using Linked Memory ,[object Object],[object Object],[object Object],[object Object]
For the utilization of the concept of linked memory, we usually define a structure, called linked list.
Linked Lists ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object], Head data pointer node A B C A
Linked List ,[object Object],[object Object],[object Object],Head  Current 2 6 1 7 8
Representation of Link List in Computer Memory
Inserting a new node ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Inserting to the Front ,[object Object],[object Object],[object Object],[object Object],head 48 17 142 head 93
Inserting to the End ,[object Object],[object Object],[object Object],[object Object],[object Object],48 17 142 head // 93 //
Inserting to the Middle ,[object Object],[object Object],[object Object],[object Object],[object Object],17 48 142 head // 93 // 142
Searching a Linked List ,[object Object],[object Object]
Deleting a node ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The Scenario 4 17 head 4 17 head 4 17 head 4 17 head 42 6 42 6 42 42
Traversing a Link List ,[object Object],[object Object],[object Object],[object Object]
Link List in C# ,[object Object],[object Object],[object Object],[object Object]
AN OBJECT-ORIENTED LINKED LIST DESIGN ,[object Object],[object Object],[object Object],[object Object]
The Node Class ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The LinkedList Class ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Insert Method ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Remove Method ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
PrintList Method ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Analysis of Link List ,[object Object],[object Object],[object Object]
Analysis of Link List ,[object Object],[object Object],[object Object],[object Object],[object Object]
Variations of Linked Lists ,[object Object],[object Object],[object Object],[object Object],Head   A B C
Variations of Linked Lists ,[object Object],[object Object],[object Object],Head A B C
Josephus Problem ,[object Object],2 3 4 5 6 7 8 9 10 N=10, M=3 4 5 6 7 8 9 10 1 2 3 Eliminated
Josephus Problem ,[object Object],[object Object],[object Object]
Array versus Linked Lists ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
What is a Priority Queues? ,[object Object],[object Object],[object Object],[object Object]
What’s so different? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Priority Queue ,[object Object]
Continue…. ,[object Object],[object Object],[object Object],[object Object]
Why Priority Queue ? ,[object Object],[object Object],[object Object],[object Object],[object Object]
The Concept of Key ,[object Object],Course Priority Due Date Database Management System 3 26 th -December-2009 Data Structure And Algorithm 1 26 th -November-2009 Computer Architecture And Organization 2 6 th -December-2009
Representation of Priority Queue  ,[object Object],[object Object],[object Object],[object Object]
One-Way List Representation of a Priority Queue ,[object Object],[object Object],[object Object],[object Object]
Array Representation of Priority Queue ,[object Object],[object Object],[object Object]
Linked List based Implementation of Priority Queue
Continue….
Implementation of Operation
Continue….
Continue….

Weitere ähnliche Inhalte

Was ist angesagt?

Java Collections
Java CollectionsJava Collections
Java Collections
parag
 

Was ist angesagt? (20)

UNIT I LINEAR DATA STRUCTURES – LIST
UNIT I 	LINEAR DATA STRUCTURES – LIST 	UNIT I 	LINEAR DATA STRUCTURES – LIST
UNIT I LINEAR DATA STRUCTURES – LIST
 
Datastructure
DatastructureDatastructure
Datastructure
 
Java collections concept
Java collections conceptJava collections concept
Java collections concept
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
07 java collection
07 java collection07 java collection
07 java collection
 
Java Collections
Java CollectionsJava Collections
Java Collections
 
Java Queue.pptx
Java Queue.pptxJava Queue.pptx
Java Queue.pptx
 
L11 array list
L11 array listL11 array list
L11 array list
 
Linked List
Linked ListLinked List
Linked List
 
Data Structures in Python
Data Structures in PythonData Structures in Python
Data Structures in Python
 
Presentation1
Presentation1Presentation1
Presentation1
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Collections - Maps
Collections - Maps Collections - Maps
Collections - Maps
 
C# Generics
C# GenericsC# Generics
C# Generics
 
Java collection
Java collectionJava collection
Java collection
 
Python Pandas
Python PandasPython Pandas
Python Pandas
 
Python array
Python arrayPython array
Python array
 
Linked List
Linked ListLinked List
Linked List
 
Join
JoinJoin
Join
 
CS8391 Data Structures Part B Questions Anna University
CS8391 Data Structures Part B Questions Anna UniversityCS8391 Data Structures Part B Questions Anna University
CS8391 Data Structures Part B Questions Anna University
 

Andere mochten auch

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
Tushar Aneyrao
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and Algorithm
Dhaval Kaneria
 
Data structures / C++ Program examples
Data structures / C++ Program examplesData structures / C++ Program examples
Data structures / C++ Program examples
Kevin III
 

Andere mochten auch (20)

Linked list
Linked listLinked list
Linked list
 
Linked lists
Linked listsLinked lists
Linked lists
 
Single linked list
Single linked listSingle linked list
Single 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
linked list linked list
linked list
 
Link List
Link ListLink List
Link List
 
Linked lists
Linked listsLinked lists
Linked lists
 
Introduction to data structures and Algorithm
Introduction to data structures and AlgorithmIntroduction to data structures and Algorithm
Introduction to data structures and Algorithm
 
DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURES
 
Python Spell Checker
Python Spell CheckerPython Spell Checker
Python Spell Checker
 
General Solution for Josephus Problem
General Solution for Josephus ProblemGeneral Solution for Josephus Problem
General Solution for Josephus Problem
 
Computer notes - Josephus Problem
Computer notes - Josephus ProblemComputer notes - Josephus Problem
Computer notes - Josephus Problem
 
Lec5
Lec5Lec5
Lec5
 
Doubly Linked List || Operations || Algorithms
Doubly Linked List || Operations || AlgorithmsDoubly Linked List || Operations || Algorithms
Doubly Linked List || Operations || Algorithms
 
Heaps
HeapsHeaps
Heaps
 
Stacks,queues,linked-list
Stacks,queues,linked-listStacks,queues,linked-list
Stacks,queues,linked-list
 
Lecture1 data structure(introduction)
Lecture1 data structure(introduction)Lecture1 data structure(introduction)
Lecture1 data structure(introduction)
 
BSc I year practicals
BSc I year practicalsBSc I year practicals
BSc I year practicals
 
Abstract Data Types
Abstract Data TypesAbstract Data Types
Abstract Data Types
 
Data structures / C++ Program examples
Data structures / C++ Program examplesData structures / C++ Program examples
Data structures / C++ Program examples
 

Ähnlich wie linked list (c#)

computer notes - Stack
computer notes - Stackcomputer notes - Stack
computer notes - Stack
ecomputernotes
 
Linked List Objective The purpose of this exercise is to cr.pdf
Linked List Objective The purpose of this exercise is to cr.pdfLinked List Objective The purpose of this exercise is to cr.pdf
Linked List Objective The purpose of this exercise is to cr.pdf
adityacomputers001
 

Ähnlich wie linked list (c#) (20)

computer notes - List implementation
computer notes - List implementationcomputer notes - List implementation
computer notes - List implementation
 
Data Structure lec#2
Data Structure lec#2Data Structure lec#2
Data Structure lec#2
 
AD3251-LINKED LIST,STACK ADT,QUEUE ADT.docx
AD3251-LINKED LIST,STACK ADT,QUEUE ADT.docxAD3251-LINKED LIST,STACK ADT,QUEUE ADT.docx
AD3251-LINKED LIST,STACK ADT,QUEUE ADT.docx
 
List data structure
List data structure List data structure
List data structure
 
List Data Structure
List Data StructureList Data Structure
List Data Structure
 
Data Structures Design Notes.pdf
Data Structures Design Notes.pdfData Structures Design Notes.pdf
Data Structures Design Notes.pdf
 
Data Structure
Data StructureData Structure
Data Structure
 
Data Structures (CS8391)
Data Structures (CS8391)Data Structures (CS8391)
Data Structures (CS8391)
 
unit-ids17-180709051413-1.pdf
unit-ids17-180709051413-1.pdfunit-ids17-180709051413-1.pdf
unit-ids17-180709051413-1.pdf
 
MODULE 5-Searching and-sorting
MODULE 5-Searching and-sortingMODULE 5-Searching and-sorting
MODULE 5-Searching and-sorting
 
unit 5 stack & queue.ppt
unit 5 stack & queue.pptunit 5 stack & queue.ppt
unit 5 stack & queue.ppt
 
Lecture2
Lecture2Lecture2
Lecture2
 
introduction_dst.pptx
introduction_dst.pptxintroduction_dst.pptx
introduction_dst.pptx
 
computer notes - Stack
computer notes - Stackcomputer notes - Stack
computer notes - Stack
 
Ds notes
Ds notesDs notes
Ds notes
 
data structures and algorithms Unit 3
data structures and algorithms Unit 3data structures and algorithms Unit 3
data structures and algorithms Unit 3
 
General Data structures
General Data structuresGeneral Data structures
General Data structures
 
computer notes - Linked list
computer notes - Linked listcomputer notes - Linked list
computer notes - Linked list
 
Linked lists
Linked listsLinked lists
Linked lists
 
Linked List Objective The purpose of this exercise is to cr.pdf
Linked List Objective The purpose of this exercise is to cr.pdfLinked List Objective The purpose of this exercise is to cr.pdf
Linked List Objective The purpose of this exercise is to cr.pdf
 

Kürzlich hochgeladen

Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
MateoGardella
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
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
 
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
 

Kürzlich hochgeladen (20)

fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
SECOND SEMESTER TOPIC COVERAGE SY 2023-2024 Trends, Networks, and Critical Th...
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
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
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
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
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
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
 
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
 
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
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 

linked list (c#)

  • 1.  
  • 2.  
  • 3.
  • 4.
  • 5. Operations a programmer performs with a list data structure. Operation Name Description createList() Create a new list (presumably empty) copy() Set one list to be a copy of another clear(); Clear a list (remove all elements) insert(X, ?) Insert element X at a particular position in the list remove(?) Remove element at some position in the list get(?) Get element at a given position update(X, ?) Replace the element at a given position with X find(X) Determine if the element X is in the list length() Returns the length of the list.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.  
  • 16.
  • 17. For the utilization of the concept of linked memory, we usually define a structure, called linked list.
  • 18.
  • 19.
  • 20. Representation of Link List in Computer Memory
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27. The Scenario 4 17 head 4 17 head 4 17 head 4 17 head 42 6 42 6 42 42
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52. Linked List based Implementation of Priority Queue

Hinweis der Redaktion

  1. In the above code, we execute a for loop to traverse the array. The number of execution of this loop is equal to the size of the list. This for loop gets terminated when the value of loop variable ( j ) increases from the size of the list. However we terminate the loop with the break statement if the element is found at a position. When the control comes out from the loop, we check the value of j . If the value of j is less than the size of the array, it means that the loop was terminated by the break statement. We use the break statement when we find the required element (x) in the list. The execution of break statement shows that the required element was found at the position equal to the value of j . So the program sets the current position to j and comes out the function by returning 1 (i.e. true). If the value of j is greater than the size of the array, it means that the whole array has traversed and the required element is not found. So we simply return 0 (i.e. false) and come out of the function.
  2. You may notice here that we are returning the size {in the length () }of the list and not the size of the array being used internally to implement the list. This size is the number of the elements of the list, stored in the array.
  3. Add example from pg: 115
  4. You don't need to use pointers to create a linked list in C#. Just store an object reference to the next list element.
  5. Fig: Pg 194