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 :
Double linked list c8
It has three elements:
1. The Variable(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.
3. The References which refers to the previous element in the
Linked List
This Reference has the value of (nil) in the first element in the
Linked List.
Program test1;
Type
D_P = ^D_R;
D_R = record
num : integer;
next,prev : D_P;
end;
Now let’s meet with some procedures
which are used in DLL
It has three cases:
1. Insert an element in the first of DLL
2. Insert an element in the last of DLL
3. Insert an element anywhere else
Procedure Insert (var L_S,L_E: D_P; numb: integer)
Var
S,temp : D_P; located : boolean
Begin
new(temp);
temp^.num := numb;
temp^.next := nil;
temp^.prev := nil;
if (L_S = nil) then
begin
L_S := temp; L_E := temp;
end
else
begin
S := L_S; located := false;
while (S <> nil) and (not located) do
begin
if (S^.num < numb) then
S := S^.next;
else
located := true;
end;
temp^.next := S;
if (L_S = S) then
begin
L_S^.prev := temp;
L_S := temp;
end
else if (S = nil) then
begin
L_E^.next := temp;
temp^.prev := L_E;
L_E := temp;
end
else
begin
S^.prev^.next := temp;
temp^.prev := S^.prev;
S^.prev := temp;
end;
end;
End;
It has three cases:
1. Delete the first element
2. Delete the last element
3. Delete any other element
Procedure Delete(var L_S,L_E: D_P; numb: integer;
flag: char)
Var
S,temp : D_P;
Begin
if (L_S = nil) then flag := ‘0’;
if (numb = L_S^.num) then
begin
flag := ‘1’;
temp := L_S;
L_S := L_S^.next;
L_S^.prev := nil;
dispose(temp);
end
else if (numb = L_E^.num) then
begin
flag := ‘1’;
temp := L_E;
L_E := L_E^.prev;
L_E^.next := nil;
dispose(temp);
end
else
begin
S := L_S;
while (S <> nil) and (S^.num <> numb) do
S := S^.next
if (S = nil) then flag := ‘2’
else
begin
flag := ‘1’;
S^.next^.prev := S^.prev;
S^.prev^.next := S^.next;
dispose(S);
end;
end;
End;
Double linked list c8

More Related Content

PDF
Linked lists c7
DOCX
Bubble sorting lab manual
PDF
Pointers c5
PPTX
Python list functions
PPT
Lect 11-12 Zaheer Abbas
PPT
List data structure
PDF
practice problems on array IN SWIFT
PPT
Data Structures - Searching & sorting
Linked lists c7
Bubble sorting lab manual
Pointers c5
Python list functions
Lect 11-12 Zaheer Abbas
List data structure
practice problems on array IN SWIFT
Data Structures - Searching & sorting

What's hot (10)

PPT
PPT
Lecture 15 16
PPTX
Compiler Design LR parsing SLR ,LALR CLR
PPT
Presentation mam saima kanwal
PPT
Chapter Five(2)
PDF
Iswc 2016 completeness correctude
PDF
Bottom up parser
PDF
Module 01 Stack and Recursion
PPTX
Recursive Descent Parsing. Automata Subjects
Lecture 15 16
Compiler Design LR parsing SLR ,LALR CLR
Presentation mam saima kanwal
Chapter Five(2)
Iswc 2016 completeness correctude
Bottom up parser
Module 01 Stack and Recursion
Recursive Descent Parsing. Automata Subjects
Ad

Viewers also liked (18)

PPTX
Double linked list
PPTX
8086 Microprocessor powerpoint
PPT
8086 pin function
PPT
8086 pin details
PPTX
PIN Specification of 8086 Microprocessor
PPTX
Binary Search Tree in Data Structure
PPT
Link List
PPT
Binary tree
DOCX
8086 pin diagram description
PPT
Linked lists
PPT
The Intel 8086 microprocessor
PDF
8086 microprocessor
PPTX
Linked list
PPTX
Microprocessor 8086
PPT
Lecture 1 data structures and algorithms
PPTX
8086 microprocessor-architecture
PPTX
Doubly linked list
PPT
DATA STRUCTURES
Double linked list
8086 Microprocessor powerpoint
8086 pin function
8086 pin details
PIN Specification of 8086 Microprocessor
Binary Search Tree in Data Structure
Link List
Binary tree
8086 pin diagram description
Linked lists
The Intel 8086 microprocessor
8086 microprocessor
Linked list
Microprocessor 8086
Lecture 1 data structures and algorithms
8086 microprocessor-architecture
Doubly linked list
DATA STRUCTURES
Ad

Similar to Double linked list c8 (20)

PPT
PDF
2Bytesprog2 course_2014_c6_single linked list
PDF
2Bytesprog2 course_2014_c5_pointers
PDF
Stack c6
PPTX
Assignment
PPT
Maclennan chap5-pascal
PDF
Sets c1
PDF
Unit - 2.pdf
PPT
Data structure lecture 1
PPT
recursion.ppt
PPTX
U2.linked list
PPT
List Data Structure
PDF
Apple IIgs Programming (K Fest)
PPTX
Assignment 2
PDF
2Bytesprog2 course_2014_c7_double_lists
PPTX
Data structure using c module 1
PPSX
Data Structure (Dynamic Array and Linked List)
PDF
Function procedure c6 c7
PDF
computer notes - Memory organization
2Bytesprog2 course_2014_c6_single linked list
2Bytesprog2 course_2014_c5_pointers
Stack c6
Assignment
Maclennan chap5-pascal
Sets c1
Unit - 2.pdf
Data structure lecture 1
recursion.ppt
U2.linked list
List Data Structure
Apple IIgs Programming (K Fest)
Assignment 2
2Bytesprog2 course_2014_c7_double_lists
Data structure using c module 1
Data Structure (Dynamic Array and Linked List)
Function procedure c6 c7
computer notes - Memory organization

More from Omar Al-Sabek (12)

PPTX
Google Big Table
PDF
Online Certificate Data Mining with Weka
PDF
Agile Methodology
PPTX
E payment Project Demo
PPTX
A petri-net
PDF
Records c2
PPTX
Files c3
PPTX
Files c4
PDF
Control structures c2 c3
PDF
Programming paradigms c1
PDF
Arrays c4 c5
Google Big Table
Online Certificate Data Mining with Weka
Agile Methodology
E payment Project Demo
A petri-net
Records c2
Files c3
Files c4
Control structures c2 c3
Programming paradigms c1
Arrays c4 c5

Recently uploaded (20)

PPTX
History, Philosophy and sociology of education (1).pptx
PPTX
Orientation - ARALprogram of Deped to the Parents.pptx
PDF
Classroom Observation Tools for Teachers
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Weekly quiz Compilation Jan -July 25.pdf
PPTX
Lesson notes of climatology university.
PDF
Complications of Minimal Access Surgery at WLH
PDF
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
Trump Administration's workforce development strategy
PDF
Yogi Goddess Pres Conference Studio Updates
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
Chinmaya Tiranga quiz Grand Finale.pdf
PDF
What if we spent less time fighting change, and more time building what’s rig...
PDF
Anesthesia in Laparoscopic Surgery in India
History, Philosophy and sociology of education (1).pptx
Orientation - ARALprogram of Deped to the Parents.pptx
Classroom Observation Tools for Teachers
Supply Chain Operations Speaking Notes -ICLT Program
Weekly quiz Compilation Jan -July 25.pdf
Lesson notes of climatology university.
Complications of Minimal Access Surgery at WLH
LNK 2025 (2).pdf MWEHEHEHEHEHEHEHEHEHEHE
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Trump Administration's workforce development strategy
Yogi Goddess Pres Conference Studio Updates
Final Presentation General Medicine 03-08-2024.pptx
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
LDMMIA Reiki Yoga Finals Review Spring Summer
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
Chinmaya Tiranga quiz Grand Finale.pdf
What if we spent less time fighting change, and more time building what’s rig...
Anesthesia in Laparoscopic Surgery in India

Double linked list c8

  • 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 :
  • 4. It has three elements: 1. The Variable(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. 3. The References which refers to the previous element in the Linked List This Reference has the value of (nil) in the first element in the Linked List.
  • 5. Program test1; Type D_P = ^D_R; D_R = record num : integer; next,prev : D_P; end; Now let’s meet with some procedures which are used in DLL
  • 6. It has three cases: 1. Insert an element in the first of DLL 2. Insert an element in the last of DLL 3. Insert an element anywhere else
  • 7. Procedure Insert (var L_S,L_E: D_P; numb: integer) Var S,temp : D_P; located : boolean Begin new(temp); temp^.num := numb; temp^.next := nil; temp^.prev := nil; if (L_S = nil) then begin L_S := temp; L_E := temp; end
  • 8. else begin S := L_S; located := false; while (S <> nil) and (not located) do begin if (S^.num < numb) then S := S^.next; else located := true; end; temp^.next := S;
  • 9. if (L_S = S) then begin L_S^.prev := temp; L_S := temp; end else if (S = nil) then begin L_E^.next := temp; temp^.prev := L_E; L_E := temp; end
  • 10. else begin S^.prev^.next := temp; temp^.prev := S^.prev; S^.prev := temp; end; end; End;
  • 11. It has three cases: 1. Delete the first element 2. Delete the last element 3. Delete any other element
  • 12. Procedure Delete(var L_S,L_E: D_P; numb: integer; flag: char) Var S,temp : D_P; Begin if (L_S = nil) then flag := ‘0’; if (numb = L_S^.num) then begin flag := ‘1’; temp := L_S; L_S := L_S^.next; L_S^.prev := nil; dispose(temp); end
  • 13. else if (numb = L_E^.num) then begin flag := ‘1’; temp := L_E; L_E := L_E^.prev; L_E^.next := nil; dispose(temp); end
  • 14. else begin S := L_S; while (S <> nil) and (S^.num <> numb) do S := S^.next if (S = nil) then flag := ‘2’ else begin flag := ‘1’; S^.next^.prev := S^.prev; S^.prev^.next := S^.next; dispose(S); end; end; End;