SlideShare a Scribd company logo
Pascal Programming Language
Omar ElSabek & Fayez Ghazzawi
IT Engineering
3th year – UNKNOWN Department
programming II
Sets
Record
Files (Text & Binary)
Pointers
Linked Lists
Unit
Course Index :
So the Linked List is:
Juuust like an array with unlimited elements ,because all the
elements are reserved inside the memory in “RunTime”
So the Linked Lists were born so there is no constant size for
any array
We can say that the Linked List is an array with inconstant size
There are two forms for Linked Lists:
1. Single Linked Lists “SLL”
2. Double Linked Lists “DLL”
It has two elements:
1. TheVariable(s) with Data type(s) “the same with all the
Linked List elements”
2. The References which refers to the next element in the
Linked List
This Reference has the value of (nil) in the last element in
the Linked List
Program test1;
Type
L_P = ^L_R;
L_R = record
num : integer;
next : L_P;
end;
Now let’s meet with some procedures
which are used in SLL
It has three cases:
1. Insert an element in the first of SLL
2. Insert an element in the last of SLL
3. Insert an element anywhere else
Procedure Insert (var L_S: L_P; numb: integer)
Var
P,S,temp : L_P; located : boolean
Begin
new(temp);
temp^.num := numb;
temp^.next := nil;
if (L_S = nil) then
L_S := temp
else
begin
S := L_S;
located := false;
while (S <> nil) and (not located) do
begin
if (S^.num < numb) then
begin
P := S;
S := S^.next;
end
else
located := true;
end;
temp^.next := S;
if (L_S = S) then
L_S := temp
else
P^.next := temp;
end;
End.
It has two cases:
1. Delete the first element
2. Delete any other element
Procedure Delete(var L_S: L_P; numb: integer;
flag: char)
Var
S,temp : L_P; located : boolean
Begin
if (numb = L_S^.num) then
begin
flag := ‘1’;
temp := L_S;
L_S := L_S^.next;
dispose(temp);
end
else
begin
S := L_S;
located := false;
while (S^.next <> nil) and (not located) do
begin
if (S^.next^.num <> numb) then
S := S^.next
else
located := true;
end;
if (not located) then
flag := ‘2’
else
begin
flag := ‘1’;
temp := S^.next;
S^.next := temp^.next;
dispose(temp);
end;
end;
End.
Linked lists c7

More Related Content

Similar to Linked lists c7

1.3 Linked List.pptx
1.3 Linked List.pptx1.3 Linked List.pptx
1.3 Linked List.pptx
ssuserd2f031
 
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
 
Link list part 1
Link list part 1Link list part 1
Link list part 1
Anaya Zafar
 
List Data Structure
List Data StructureList Data Structure
List Data Structure
Zidny Nafan
 
Linked list
Linked list Linked list
Linked list
Arbind Mandal
 
2Bytesprog2 course_2014_c6_single linked list
2Bytesprog2 course_2014_c6_single linked list2Bytesprog2 course_2014_c6_single linked list
2Bytesprog2 course_2014_c6_single linked list
kinan keshkeh
 
Linked lists
Linked listsLinked lists
Linked lists
Eleonora Ciceri
 
unit 2- PPT.pdf
unit 2- PPT.pdfunit 2- PPT.pdf
unit 2- PPT.pdf
PranavMakwana6
 
Data structures: linear lists
Data structures: linear listsData structures: linear lists
Data structures: linear lists
ToniyaP1
 
Data Structure Lecture 7
Data Structure Lecture 7Data Structure Lecture 7
Data Structure Lecture 7Teksify
 
Linked list
Linked listLinked list
Linked list
RahulGandhi110
 
use python Problem 2. Selection Sort In this problem you will implem.pdf
use python Problem 2. Selection Sort In this problem you will implem.pdfuse python Problem 2. Selection Sort In this problem you will implem.pdf
use python Problem 2. Selection Sort In this problem you will implem.pdf
sales223546
 
list procedures
list procedureslist procedures
list procedures
Rajendran
 
day 13.pptx
day 13.pptxday 13.pptx
day 13.pptx
codewavecommunity44
 
Linked lists in Data Structure
Linked lists in Data StructureLinked lists in Data Structure
Linked lists in Data Structure
Muhazzab Chouhadry
 
Dounly linked list
Dounly linked listDounly linked list
Dounly linked list
NirmalPandey23
 
Unit - 2.pdf
Unit - 2.pdfUnit - 2.pdf
Unit - 2.pdf
AravindAnand21
 
Data structure
 Data structure Data structure
Data structure
Shahariar limon
 

Similar to Linked lists c7 (20)

1.3 Linked List.pptx
1.3 Linked List.pptx1.3 Linked List.pptx
1.3 Linked List.pptx
 
Data structure using c module 1
Data structure using c module 1Data structure using c module 1
Data structure using c module 1
 
Link list part 1
Link list part 1Link list part 1
Link list part 1
 
List Data Structure
List Data StructureList Data Structure
List Data Structure
 
List data structure
List data structure List data structure
List data structure
 
Lisp
LispLisp
Lisp
 
Linked list
Linked list Linked list
Linked list
 
2Bytesprog2 course_2014_c6_single linked list
2Bytesprog2 course_2014_c6_single linked list2Bytesprog2 course_2014_c6_single linked list
2Bytesprog2 course_2014_c6_single linked list
 
Linked lists
Linked listsLinked lists
Linked lists
 
unit 2- PPT.pdf
unit 2- PPT.pdfunit 2- PPT.pdf
unit 2- PPT.pdf
 
Data structures: linear lists
Data structures: linear listsData structures: linear lists
Data structures: linear lists
 
Data Structure Lecture 7
Data Structure Lecture 7Data Structure Lecture 7
Data Structure Lecture 7
 
Linked list
Linked listLinked list
Linked list
 
use python Problem 2. Selection Sort In this problem you will implem.pdf
use python Problem 2. Selection Sort In this problem you will implem.pdfuse python Problem 2. Selection Sort In this problem you will implem.pdf
use python Problem 2. Selection Sort In this problem you will implem.pdf
 
list procedures
list procedureslist procedures
list procedures
 
day 13.pptx
day 13.pptxday 13.pptx
day 13.pptx
 
Linked lists in Data Structure
Linked lists in Data StructureLinked lists in Data Structure
Linked lists in Data Structure
 
Dounly linked list
Dounly linked listDounly linked list
Dounly linked list
 
Unit - 2.pdf
Unit - 2.pdfUnit - 2.pdf
Unit - 2.pdf
 
Data structure
 Data structure Data structure
Data structure
 

More from Omar Al-Sabek

Google Big Table
Google Big TableGoogle Big Table
Google Big Table
Omar Al-Sabek
 
Online Certificate Data Mining with Weka
Online Certificate Data Mining with WekaOnline Certificate Data Mining with Weka
Online Certificate Data Mining with Weka
Omar Al-Sabek
 
Agile Methodology
Agile MethodologyAgile Methodology
Agile Methodology
Omar Al-Sabek
 
Git
GitGit
E payment Project Demo
E payment Project DemoE payment Project Demo
E payment Project Demo
Omar Al-Sabek
 
A petri-net
A petri-netA petri-net
A petri-net
Omar Al-Sabek
 
Sets c1
Sets c1Sets c1
Sets c1
Omar Al-Sabek
 
Records c2
Records c2Records c2
Records c2
Omar Al-Sabek
 
Files c3
Files c3Files c3
Files c3
Omar Al-Sabek
 
Files c4
Files c4Files c4
Files c4
Omar Al-Sabek
 
Pointers c5
Pointers c5Pointers c5
Pointers c5
Omar Al-Sabek
 
Function procedure c6 c7
Function procedure  c6 c7Function procedure  c6 c7
Function procedure c6 c7
Omar Al-Sabek
 
Control structures c2 c3
Control structures c2 c3Control structures c2 c3
Control structures c2 c3
Omar Al-Sabek
 
Programming paradigms c1
Programming paradigms c1Programming paradigms c1
Programming paradigms c1
Omar Al-Sabek
 
Arrays c4 c5
Arrays c4 c5Arrays c4 c5
Arrays c4 c5
Omar Al-Sabek
 

More from Omar Al-Sabek (15)

Google Big Table
Google Big TableGoogle Big Table
Google Big Table
 
Online Certificate Data Mining with Weka
Online Certificate Data Mining with WekaOnline Certificate Data Mining with Weka
Online Certificate Data Mining with Weka
 
Agile Methodology
Agile MethodologyAgile Methodology
Agile Methodology
 
Git
GitGit
Git
 
E payment Project Demo
E payment Project DemoE payment Project Demo
E payment Project Demo
 
A petri-net
A petri-netA petri-net
A petri-net
 
Sets c1
Sets c1Sets c1
Sets c1
 
Records c2
Records c2Records c2
Records c2
 
Files c3
Files c3Files c3
Files c3
 
Files c4
Files c4Files c4
Files c4
 
Pointers c5
Pointers c5Pointers c5
Pointers c5
 
Function procedure c6 c7
Function procedure  c6 c7Function procedure  c6 c7
Function procedure c6 c7
 
Control structures c2 c3
Control structures c2 c3Control structures c2 c3
Control structures c2 c3
 
Programming paradigms c1
Programming paradigms c1Programming paradigms c1
Programming paradigms c1
 
Arrays c4 c5
Arrays c4 c5Arrays c4 c5
Arrays c4 c5
 

Recently uploaded

Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
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
 
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
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
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 Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
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
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
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
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 

Recently uploaded (20)

Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
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 ...
 
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
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
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 Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
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
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
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
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 

Linked lists c7

  • 1. Pascal Programming Language Omar ElSabek & Fayez Ghazzawi IT Engineering 3th year – UNKNOWN Department programming II
  • 2. Sets Record Files (Text & Binary) Pointers Linked Lists Unit Course Index :
  • 3.
  • 4. So the Linked List is: Juuust like an array with unlimited elements ,because all the elements are reserved inside the memory in “RunTime” So the Linked Lists were born so there is no constant size for any array We can say that the Linked List is an array with inconstant size
  • 5. There are two forms for Linked Lists: 1. Single Linked Lists “SLL” 2. Double Linked Lists “DLL”
  • 6. It has two elements: 1. TheVariable(s) with Data type(s) “the same with all the Linked List elements” 2. The References which refers to the next element in the Linked List This Reference has the value of (nil) in the last element in the Linked List
  • 7. Program test1; Type L_P = ^L_R; L_R = record num : integer; next : L_P; end; Now let’s meet with some procedures which are used in SLL
  • 8. It has three cases: 1. Insert an element in the first of SLL 2. Insert an element in the last of SLL 3. Insert an element anywhere else
  • 9. Procedure Insert (var L_S: L_P; numb: integer) Var P,S,temp : L_P; located : boolean Begin new(temp); temp^.num := numb; temp^.next := nil; if (L_S = nil) then L_S := temp
  • 10. else begin S := L_S; located := false; while (S <> nil) and (not located) do begin if (S^.num < numb) then begin P := S; S := S^.next; end else located := true; end;
  • 11. temp^.next := S; if (L_S = S) then L_S := temp else P^.next := temp; end; End.
  • 12. It has two cases: 1. Delete the first element 2. Delete any other element
  • 13. Procedure Delete(var L_S: L_P; numb: integer; flag: char) Var S,temp : L_P; located : boolean Begin if (numb = L_S^.num) then begin flag := ‘1’; temp := L_S; L_S := L_S^.next; dispose(temp); end
  • 14. else begin S := L_S; located := false; while (S^.next <> nil) and (not located) do begin if (S^.next^.num <> numb) then S := S^.next else located := true; end;
  • 15. if (not located) then flag := ‘2’ else begin flag := ‘1’; temp := S^.next; S^.next := temp^.next; dispose(temp); end; end; End.