SlideShare a Scribd company logo
1 of 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….

More Related Content

What's hot

class and objects
class and objectsclass and objects
class and objects
Payel Guria
 

What's hot (20)

Tuple in python
Tuple in pythonTuple in python
Tuple in python
 
Array in c++
Array in c++Array in c++
Array in c++
 
Queue ppt
Queue pptQueue ppt
Queue ppt
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
C functions
C functionsC functions
C functions
 
Packages in java
Packages in javaPackages in java
Packages in java
 
Vectors in Java
Vectors in JavaVectors in Java
Vectors in Java
 
Java input
Java inputJava input
Java input
 
Buffer and scanner
Buffer and scannerBuffer and scanner
Buffer and scanner
 
Symbol table in compiler Design
Symbol table in compiler DesignSymbol table in compiler Design
Symbol table in compiler Design
 
Constructor and Types of Constructors
Constructor and Types of ConstructorsConstructor and Types of Constructors
Constructor and Types of Constructors
 
Java-java virtual machine
Java-java virtual machineJava-java virtual machine
Java-java virtual machine
 
Constructor ppt
Constructor pptConstructor ppt
Constructor ppt
 
Java package
Java packageJava package
Java package
 
Recursive Function
Recursive FunctionRecursive Function
Recursive Function
 
Scanner class
Scanner classScanner class
Scanner class
 
Sparse matrix and its representation data structure
Sparse matrix and its representation data structureSparse matrix and its representation data structure
Sparse matrix and its representation data structure
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Introduction to Array ppt
Introduction to Array pptIntroduction to Array ppt
Introduction to Array ppt
 
class and objects
class and objectsclass and objects
class and objects
 

Viewers also liked

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
 

Viewers also liked (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
 

Similar to 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
 
Objective The purpose of this exercise is to create a Linke.pdf
Objective The purpose of this exercise is to create a Linke.pdfObjective The purpose of this exercise is to create a Linke.pdf
Objective The purpose of this exercise is to create a Linke.pdf
advancethchnologies
 

Similar to 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
 
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
 
Objective The purpose of this exercise is to create a Linke.pdf
Objective The purpose of this exercise is to create a Linke.pdfObjective The purpose of this exercise is to create a Linke.pdf
Objective The purpose of this exercise is to create a Linke.pdf
 

Recently uploaded

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
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
 
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
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 

Recently uploaded (20)

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
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . 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
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
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
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
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
 
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
 
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
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
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"
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 

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

Editor's Notes

  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