SlideShare a Scribd company logo
Prog_2 course- 2014 
2 bytes team 
Kinan keshkeh 
IT Engineering-Damascus University 
3rd year
Double Lists 
Data 
next 
prev 
L_S 
Data 
next 
prev 
Data 
prev 
prev 
next 
next 
Data 
L_E
Definition 
Type 
D_P = ^D_R; 
D_R = Record 
ID:integer; 
next:D_P; 
prev:D_P; 
end; 
var 
L_S, L_E : D_P;
Double Lists Procedures: 
1) Insert a Node 
2) Delete a Node 
3) Search Node
Insert a Node 
Data 
next 
prev 
Data 
next 
prev 
Data 
next 
prev 
Data 
next 
prev 
L_E 
Data 
next 
prev 
L_S 
Temp
1) 
L_S 
Nil 
15 
next 
prev 
Temp 
L_E
3 
next 
prev 
20 
next 
prev 
15 
next 
prev 
2) 
L_S 
S 
L_E 
Temp
3 
next 
prev 
20 
next 
prev 
15 
next 
prev 
3) 
L_S 
S 
L_E 
2 
next 
prev 
Temp
3 
next 
prev 
20 
next 
prev 
15 
next 
prev 
L_S 
S 
L_E 
2 
next 
prev 
Nil 
4) 
Temp
procedure D_L_Insert ( var L_S, L_E: D_P; KEY:integer); 
var 
Temp , S : D_P; 
Located: Boolean; 
begin 
new(Temp); 
temp^.ID:=KEY; 
temp^.next:=nil; 
temp^.prev:=nil; 
15 
next 
prev 
Temp
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 
if S^.id < key then 
S:=S^.next 
else 
Located:=True; 
Temp^.next:=S; 
+2 points
If S=L_S then 
begin 
L_S^.prev:=Temp; 
L_S:=Temp; 
end 
Else if S=nil then 
begin 
Temp^.prev := L_E; 
L_E^.next := Temp; 
L_E:=Temp; 
end 
Else 
begin 
Temp^.prev := S^.prev; 
S^.prev^.next := Temp; 
S^.prev := Temp; 
end; 
end; 
end; {procedure}
1) 
L_S 
Nil 
Delete a Node 
flag 
3 
L_E
3 
next 
prev 
20 
next 
prev 
15 
next 
prev 
L_S 
L_E 
key 
3 
2) 
temp 
3 
next 
prev 
L_S 
Nil 
temp 
L_E 
flag 
2
3 
next 
prev 
20 
next 
prev 
15 
next 
prev 
L_S 
L_E 
temp 
3) 
falg 
2 
key 
20
3 
next 
prev 
20 
next 
prev 
15 
next 
prev 
L_S 
L_E 
4) 
flag 
2 
key 
15 
S
3 
next 
prev 
20 
next 
prev 
15 
next 
prev 
L_S 
L_E 
Nil 
flag 
1 
key 
99 
5) 
S
procedure D_L_Delete ( var L_S,L_E: D_P; KEY:integer; var flag :char); 
var 
Temp , S:D_P; 
begin 
If L_S=nil then 
flag:=‘3’ 
Else if KEY =L_S^.id then 
begin 
Temp:=L_S; 
L_S:=L_S^.next; ls^.prev:=nill ; 
Dispose(Temp); 
flag:=‘2’; 
If L_s=nil then 
L_E:=nil; 
Else 
L_s^.prev:=nil; 
end
Else if KEY = L_E^.id then 
begin 
Temp:=L_E; 
L_E:=L_E^.prev; L_E^.next:=nil; Dispose(Temp); 
Flag:=‘2’; 
end 
Else 
begin 
S:=L_S; 
while (S<>nil) and (S^.id <> KEY ) do 
S:=S^.next; 
if S=nil then 
flag:=‘1’; 
else 
begin 
S^.next^.prev:=S^.prev; 
S^.prev^.next:=S^.next; Dispose(S); 
flag:=‘ 2 ’; 
end; 
end; 
end; {procedure}
Homework: 
+15 points 
اكتب اجرائية البحث عه عنصر ما في سلسة مترابطة 
مه طرفيه : 
Search( var L_s, L_E : D_P ; Key:integer; 
var p: D_P ; var flag: char); 
بحيث تحفظ الاجرائية مؤشر على مكان العنصر المراد, 
وتعيد محرف يعبر عه حالة البحث ) فشل-وجد العنصر- 
السلسلة فارغة(
Group : group link 
Mobile phone- Kinan : 0994385748 
Facebook account : kinan’s account 
2 bytes team

More Related Content

What's hot (12)

PDF
Suffix Array 構築方法の紹介
Takashi Hoshino
 
PDF
Hello, Type Systems! - Introduction to Featherweight Java
y_taka_23
 
PPT
Ch17
Abbott
 
PDF
Promise of an API
Maxim Zaks
 
DOCX
Lisp programming
ilias ahmed
 
DOCX
New microsoft office word document (2)
Syed Umair
 
PPTX
QUEUE || FUNCTION WRITING BASED ON QUEUE || LINKED LIST || DATA STRUCTURE || ...
AAKASH KUMAR
 
DOCX
8.2
namthip2539
 
PDF
Bcsl 033 data and file structures lab s1-4
Dr. Loganathan R
 
PDF
array, function, pointer, pattern matching
Shakila Mahjabin
 
PPTX
Asymptotic Analysis in Data Structure using C
Meghaj Mallick
 
PPTX
Periodic pattern mining
Ashis Kumar Chanda
 
Suffix Array 構築方法の紹介
Takashi Hoshino
 
Hello, Type Systems! - Introduction to Featherweight Java
y_taka_23
 
Ch17
Abbott
 
Promise of an API
Maxim Zaks
 
Lisp programming
ilias ahmed
 
New microsoft office word document (2)
Syed Umair
 
QUEUE || FUNCTION WRITING BASED ON QUEUE || LINKED LIST || DATA STRUCTURE || ...
AAKASH KUMAR
 
Bcsl 033 data and file structures lab s1-4
Dr. Loganathan R
 
array, function, pointer, pattern matching
Shakila Mahjabin
 
Asymptotic Analysis in Data Structure using C
Meghaj Mallick
 
Periodic pattern mining
Ashis Kumar Chanda
 

Viewers also liked (7)

PDF
2Bytesprog2 course_2014_c6_single linked list
kinan keshkeh
 
PPTX
New Orleans: Nature, Culture and the City
holzknj
 
PPTX
E learning y b-learning
Diana Osorio Paredes
 
PPTX
Ppt mediasi bab kerukunan (shinta ariyana pratiwi 021)
aniseka
 
PPTX
Farmacología ginecólogica
Mariacachafa De los Rios
 
PDF
Apuntes funciones 1º bach míos
mgarmon965
 
PDF
Finca Kosovo - The recommendation Letter from ICM
Fidan Rasimi
 
2Bytesprog2 course_2014_c6_single linked list
kinan keshkeh
 
New Orleans: Nature, Culture and the City
holzknj
 
E learning y b-learning
Diana Osorio Paredes
 
Ppt mediasi bab kerukunan (shinta ariyana pratiwi 021)
aniseka
 
Farmacología ginecólogica
Mariacachafa De los Rios
 
Apuntes funciones 1º bach míos
mgarmon965
 
Finca Kosovo - The recommendation Letter from ICM
Fidan Rasimi
 
Ad

Similar to 2Bytesprog2 course_2014_c7_double_lists (20)

PDF
2Bytesprog2 course_2014_c1_sets
kinan keshkeh
 
PDF
2Bytesprog2 course_2014_c1_sets
kinan keshkeh
 
PPTX
Data structure using c module 1
smruti sarangi
 
PPTX
Ist year Msc,2nd sem module1
blessyboban92
 
PPT
arrays
Enakshi Chanda
 
PPTX
U2.linked list
Ssankett Negi
 
PDF
2Bytesprog2 course_2014_c2_records
kinan keshkeh
 
PDF
2Bytesprog2 course_2014_c1_sets
kinan keshkeh
 
PPTX
Doubly Linked List || Operations || Algorithms
Shubham Sharma
 
PPTX
Array Data StructureData StructureData Structure.pptx
menukam354
 
PDF
Double linked list c8
Omar Al-Sabek
 
PPTX
Array
Iama Marsian
 
DOCX
Updated Lab3.docx
AleezaAnjum
 
PPT
Chapter 5: linked list data structure
Mahmoud Alfarra
 
PPTX
Deletion from a linked list
Solaiman Hridoy
 
PPTX
data structure3.pptx
SajalFayyaz
 
PDF
ADS_Lec2_Linked_Allocation
Hemanth Kumar
 
PPTX
Data structure 8.pptx
SajalFayyaz
 
PPTX
introduction to data structures and types
ankita946617
 
PPT
arrays1.ppt python programme arrays insertion
bushraashraf639
 
2Bytesprog2 course_2014_c1_sets
kinan keshkeh
 
2Bytesprog2 course_2014_c1_sets
kinan keshkeh
 
Data structure using c module 1
smruti sarangi
 
Ist year Msc,2nd sem module1
blessyboban92
 
U2.linked list
Ssankett Negi
 
2Bytesprog2 course_2014_c2_records
kinan keshkeh
 
2Bytesprog2 course_2014_c1_sets
kinan keshkeh
 
Doubly Linked List || Operations || Algorithms
Shubham Sharma
 
Array Data StructureData StructureData Structure.pptx
menukam354
 
Double linked list c8
Omar Al-Sabek
 
Updated Lab3.docx
AleezaAnjum
 
Chapter 5: linked list data structure
Mahmoud Alfarra
 
Deletion from a linked list
Solaiman Hridoy
 
data structure3.pptx
SajalFayyaz
 
ADS_Lec2_Linked_Allocation
Hemanth Kumar
 
Data structure 8.pptx
SajalFayyaz
 
introduction to data structures and types
ankita946617
 
arrays1.ppt python programme arrays insertion
bushraashraf639
 
Ad

More from kinan keshkeh (20)

PDF
10 Little Tricks to Get Your Class’s Attention (and Hold It)
kinan keshkeh
 
PDF
Simpson and lagranje dalambair math methods
kinan keshkeh
 
PDF
Shapes and calculate (area and contour) / C++ oop concept
kinan keshkeh
 
PDF
Shapes and calculate (area and contour) / C++ oop concept
kinan keshkeh
 
PDF
GeneticAlgorithms_AND_CuttingWoodAlgorithm
kinan keshkeh
 
PDF
Algorithm in discovering and correcting words errors in a dictionary or any w...
kinan keshkeh
 
PDF
2Bytesprog2 course_2014_c9_graph
kinan keshkeh
 
PDF
2Bytesprog2 course_2014_c8_units
kinan keshkeh
 
PDF
2Bytesprog2 course_2014_c4_binaryfiles
kinan keshkeh
 
PDF
2Bytesprog2 course_2014_c3_txtfiles
kinan keshkeh
 
PDF
2Bytesprog2 course_2014_c1_sets
kinan keshkeh
 
PDF
2 BytesC++ course_2014_c13_ templates
kinan keshkeh
 
PDF
2 BytesC++ course_2014_c12_ polymorphism
kinan keshkeh
 
PDF
2 BytesC++ course_2014_c11_ inheritance
kinan keshkeh
 
PDF
2 BytesC++ course_2014_c10_ separate compilation and namespaces
kinan keshkeh
 
PDF
2 BytesC++ course_2014_c9_ pointers and dynamic arrays
kinan keshkeh
 
PDF
2 BytesC++ course_2014_c8_ strings
kinan keshkeh
 
PDF
2 BytesC++ course_2014_c4_ arrays
kinan keshkeh
 
PDF
2 BytesC++ course_2014_c7_ operator overloading, friends and references
kinan keshkeh
 
PDF
2 BytesC++ course_2014_c6_ constructors and other tools
kinan keshkeh
 
10 Little Tricks to Get Your Class’s Attention (and Hold It)
kinan keshkeh
 
Simpson and lagranje dalambair math methods
kinan keshkeh
 
Shapes and calculate (area and contour) / C++ oop concept
kinan keshkeh
 
Shapes and calculate (area and contour) / C++ oop concept
kinan keshkeh
 
GeneticAlgorithms_AND_CuttingWoodAlgorithm
kinan keshkeh
 
Algorithm in discovering and correcting words errors in a dictionary or any w...
kinan keshkeh
 
2Bytesprog2 course_2014_c9_graph
kinan keshkeh
 
2Bytesprog2 course_2014_c8_units
kinan keshkeh
 
2Bytesprog2 course_2014_c4_binaryfiles
kinan keshkeh
 
2Bytesprog2 course_2014_c3_txtfiles
kinan keshkeh
 
2Bytesprog2 course_2014_c1_sets
kinan keshkeh
 
2 BytesC++ course_2014_c13_ templates
kinan keshkeh
 
2 BytesC++ course_2014_c12_ polymorphism
kinan keshkeh
 
2 BytesC++ course_2014_c11_ inheritance
kinan keshkeh
 
2 BytesC++ course_2014_c10_ separate compilation and namespaces
kinan keshkeh
 
2 BytesC++ course_2014_c9_ pointers and dynamic arrays
kinan keshkeh
 
2 BytesC++ course_2014_c8_ strings
kinan keshkeh
 
2 BytesC++ course_2014_c4_ arrays
kinan keshkeh
 
2 BytesC++ course_2014_c7_ operator overloading, friends and references
kinan keshkeh
 
2 BytesC++ course_2014_c6_ constructors and other tools
kinan keshkeh
 

Recently uploaded (20)

PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
PDF
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
PDF
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
PDF
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
PDF
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
PPTX
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PPTX
Transforming Mining & Engineering Operations with Odoo ERP | Streamline Proje...
SatishKumar2651
 
PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PDF
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
PDF
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
PDF
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
PDF
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
PPTX
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
PDF
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
Odoo CRM vs Zoho CRM: Honest Comparison 2025
Odiware Technologies Private Limited
 
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
Transforming Mining & Engineering Operations with Odoo ERP | Streamline Proje...
SatishKumar2651
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
Tally software_Introduction_Presentation
AditiBansal54083
 
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
Linux Certificate of Completion - LabEx Certificate
VICTOR MAESTRE RAMIREZ
 
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 

2Bytesprog2 course_2014_c7_double_lists

  • 1. Prog_2 course- 2014 2 bytes team Kinan keshkeh IT Engineering-Damascus University 3rd year
  • 2. Double Lists Data next prev L_S Data next prev Data prev prev next next Data L_E
  • 3. Definition Type D_P = ^D_R; D_R = Record ID:integer; next:D_P; prev:D_P; end; var L_S, L_E : D_P;
  • 4. Double Lists Procedures: 1) Insert a Node 2) Delete a Node 3) Search Node
  • 5. Insert a Node Data next prev Data next prev Data next prev Data next prev L_E Data next prev L_S Temp
  • 6. 1) L_S Nil 15 next prev Temp L_E
  • 7. 3 next prev 20 next prev 15 next prev 2) L_S S L_E Temp
  • 8. 3 next prev 20 next prev 15 next prev 3) L_S S L_E 2 next prev Temp
  • 9. 3 next prev 20 next prev 15 next prev L_S S L_E 2 next prev Nil 4) Temp
  • 10. procedure D_L_Insert ( var L_S, L_E: D_P; KEY:integer); var Temp , S : D_P; Located: Boolean; begin new(Temp); temp^.ID:=KEY; temp^.next:=nil; temp^.prev:=nil; 15 next prev Temp
  • 11. 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 if S^.id < key then S:=S^.next else Located:=True; Temp^.next:=S; +2 points
  • 12. If S=L_S then begin L_S^.prev:=Temp; L_S:=Temp; end Else if S=nil then begin Temp^.prev := L_E; L_E^.next := Temp; L_E:=Temp; end Else begin Temp^.prev := S^.prev; S^.prev^.next := Temp; S^.prev := Temp; end; end; end; {procedure}
  • 13. 1) L_S Nil Delete a Node flag 3 L_E
  • 14. 3 next prev 20 next prev 15 next prev L_S L_E key 3 2) temp 3 next prev L_S Nil temp L_E flag 2
  • 15. 3 next prev 20 next prev 15 next prev L_S L_E temp 3) falg 2 key 20
  • 16. 3 next prev 20 next prev 15 next prev L_S L_E 4) flag 2 key 15 S
  • 17. 3 next prev 20 next prev 15 next prev L_S L_E Nil flag 1 key 99 5) S
  • 18. procedure D_L_Delete ( var L_S,L_E: D_P; KEY:integer; var flag :char); var Temp , S:D_P; begin If L_S=nil then flag:=‘3’ Else if KEY =L_S^.id then begin Temp:=L_S; L_S:=L_S^.next; ls^.prev:=nill ; Dispose(Temp); flag:=‘2’; If L_s=nil then L_E:=nil; Else L_s^.prev:=nil; end
  • 19. Else if KEY = L_E^.id then begin Temp:=L_E; L_E:=L_E^.prev; L_E^.next:=nil; Dispose(Temp); Flag:=‘2’; end Else begin S:=L_S; while (S<>nil) and (S^.id <> KEY ) do S:=S^.next; if S=nil then flag:=‘1’; else begin S^.next^.prev:=S^.prev; S^.prev^.next:=S^.next; Dispose(S); flag:=‘ 2 ’; end; end; end; {procedure}
  • 20. Homework: +15 points اكتب اجرائية البحث عه عنصر ما في سلسة مترابطة مه طرفيه : Search( var L_s, L_E : D_P ; Key:integer; var p: D_P ; var flag: char); بحيث تحفظ الاجرائية مؤشر على مكان العنصر المراد, وتعيد محرف يعبر عه حالة البحث ) فشل-وجد العنصر- السلسلة فارغة(
  • 21. Group : group link Mobile phone- Kinan : 0994385748 Facebook account : kinan’s account 2 bytes team