SlideShare a Scribd company logo
2
Most read
3
Most read
using Java
2015
Data Structure
Prepared by: Mahmoud Rafeek Al-farra
in Java
3. Searching Algorithms
mfarra.cst.ps www.fb.com/MahmoudRFarra
Contents
Which is best ?
Binary Search approach
Linear search approach
Introduction
Introduction
mfarra.cst.ps www.fb.com/MahmoudRFarra
 Searching for data is a fundamental computer
programming task and one that has been studied for
many years.
There are two fundamental ways to search for data in
a list:
The sequential (linear) search approach.
The binary search approuach.
Linear search approach
mfarra.cst.ps www.fb.com/MahmoudRFarra
The linear search approach compares the key element
sequentially with each element in the data structure.
 It continues to do so until the key matches an
element in the DS or the DS is exhausted without a
match being found.
If a match is made, the linear search returns the
index of the element in the DS that matches the key.
 If no match is found, the search returns -1.
Linear search approach
mfarra.cst.ps www.fb.com/MahmoudRFarra
2 5 81 88 90 997 9 34 55 56 66 79 80
1 2 3 4 5 6 7 8 9 10 11 12 13
Wanted = 80
array
0
==‫؟‬
.... ....
The wanted value at comparison number 10 and position 9
You can see an animated example from the following link:
http://www.cs.armstrong.edu/liang/animation/web/LinearSearch.html
Linear search approach
mfarra.cst.ps www.fb.com/MahmoudRFarra
1. public class LinearSearch {
2. /** The method for finding a key in the list */
3. public static int linearSearch(int[] list, int key) {
4. for (int i = 0; i < list.length; i++) {
5. if (key == list[i])
6. return i;
7. }
8. return -1;
9. }
10. }
Binary search approach
mfarra.cst.ps www.fb.com/MahmoudRFarra
When the records you are searching through are
sorted into order, you can perform a more efficient
search than the sequential search to find a value. This
search is called a binary search.
To use this algorithm, we first need our data stored
in order (ascending, preferably) in an array.
You can see an animated example from the following link:
http://www.cs.armstrong.edu/liang/animation/web/BinarySearch.html
Binary Search approach
mfarra.cst.ps www.fb.com/MahmoudRFarra
Binary Search approach
2 5 81 88 90 997 9 34 55 56 66 79 80
1 2 3 4 5 6 7 8 9 10 11 12 13
(0+13) / 2 = 6
If (array[6] == 80)
return 6
Elseif (array[6] > 80)
High = 6 -1
Else
Low = 6+1
Middle = (low + high)/2
Wanted = 80
array
0
(7+13) / 2 = 10
If (array[10] == 80)
return 10
Elseif (array[10] > 80)
High = 10 -1
Else
Low = 10+1
(7+9) / 2 = 8
If (array[8] == 80)
return 8
Elseif (array[8] > 80)
High = 8-1
Else
Low = 8+1
1 2 3
mfarra.cst.ps www.fb.com/MahmoudRFarra
Binary Search approach
2 5 81 88 90 997 9 34 55 56 66 79 80
1 2 3 4 5 6 7 8 9 10 11 12 13
Middle = (low + high)/2
Wanted = 80
array
0
(7+9) / 2 = 8
If (array[8] == 80)
return 8
Elseif (array[8] > 80)
High = 8-1
Else
Low = 8+1
3
(9+9) / 2 = 9
If (array[9] == 80)
return 8
Elseif (array[9] > 80)
High = 9-1
Else
Low = 9+1
4
return 8
mfarra.cst.ps www.fb.com/MahmoudRFarra
Binary Search approach
mfarra.cst.ps www.fb.com/MahmoudRFarra
1. public class BinarySearch {
2. public static int binarySearch(int[] list, int key) {
3. int low = 0;
4. int high = list.length - 1;
5. while (high >= low) {
6. int mid = (low + high) / 2;
7. if (key < list[mid])
8. high = mid - 1;
9. else if (key == list[mid])
10. return mid;
11. else
12. low = mid + 1;
13. }
14. return –low - 1; // Now high < low, key not found
15. }
16. }
Which is best ?
mfarra.cst.ps www.fb.com/MahmoudRFarra
The
best
Complexity
Data
structure
Suitable
data
Size of
data
Which is best ?
mfarra.cst.ps www.fb.com/MahmoudRFarra
 If an array is sorted, binary search is more efficient
than linear search for finding an element in the array.
 Linear search is useful for finding an element in a
small array or an unsorted array, but it is inefficient
for large arrays.
 Binary search is more efficient, but it requires that
the array be presorted.
Which is best ?
mfarra.cst.ps www.fb.com/MahmoudRFarra
Complexity time of linear approach is: O(n)
Complexity time of binary approach is: O( log(n))
 Supported data structure of linear: ?
 Supported data structure of Binary: ?
using Java
2015
FB: M a h m o u d R F a r r a
YouTube: M a h m o u d R F a r
SlidesShare: mralfarra
Thank you

More Related Content

What's hot (20)

PPTX
Inheritance ppt
Nivegeetha
 
PPTX
Inline function
Tech_MX
 
PPTX
C functions
University of Potsdam
 
PPT
File handling in c
David Livingston J
 
PDF
Java Linked List Tutorial | Edureka
Edureka!
 
PPS
Wrapper class
kamal kotecha
 
PPTX
07. Virtual Functions
Haresh Jaiswal
 
PPTX
Functions in c++
Rokonuzzaman Rony
 
PPTX
Loops in Python
AbhayDhupar
 
PPTX
Functions in Python
Kamal Acharya
 
PPTX
Control structures in java
VINOTH R
 
PPTX
C++ string
Dheenadayalan18
 
PPTX
Pointers in c language
Tanmay Modi
 
PPTX
Super keyword in java
Hitesh Kumar
 
PPTX
Methods in java
chauhankapil
 
PPTX
Forloop
Dipen Vasoya
 
PPTX
Searching and sorting
PoojithaBollikonda
 
PPT
Functions in C++
Mohammed Sikander
 
PPTX
STACKS IN DATASTRUCTURE
Archie Jamwal
 
PPTX
Java string handling
Salman Khan
 
Inheritance ppt
Nivegeetha
 
Inline function
Tech_MX
 
File handling in c
David Livingston J
 
Java Linked List Tutorial | Edureka
Edureka!
 
Wrapper class
kamal kotecha
 
07. Virtual Functions
Haresh Jaiswal
 
Functions in c++
Rokonuzzaman Rony
 
Loops in Python
AbhayDhupar
 
Functions in Python
Kamal Acharya
 
Control structures in java
VINOTH R
 
C++ string
Dheenadayalan18
 
Pointers in c language
Tanmay Modi
 
Super keyword in java
Hitesh Kumar
 
Methods in java
chauhankapil
 
Forloop
Dipen Vasoya
 
Searching and sorting
PoojithaBollikonda
 
Functions in C++
Mohammed Sikander
 
STACKS IN DATASTRUCTURE
Archie Jamwal
 
Java string handling
Salman Khan
 

Viewers also liked (20)

DOCX
25 java tough interview questions
Arun Banotra
 
PPTX
Java Sorting Algorithms
Brendan Campbell
 
DOCX
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...
Sunil Kumar Gunasekaran
 
PDF
Columna_bernik_Dic 2009pdf
Leticia Brando
 
PDF
私のちびっとタスク管理 - RxTstudy #6
komeshogu n
 
PDF
Boas práticas para manipulação de alimentos
Cleber Lima
 
PPTX
UbD Sept 2016
Jacob Martens
 
PDF
Cuando las-mujeres-matan
julia ramirez
 
PDF
ゆるキャラから学んだもの
komeshogu n
 
PDF
Disneyから学んだこと
komeshogu n
 
PDF
企業研究〜コカ・コーラ株式会社〜
Koheichan
 
PDF
R.D Nº 0520 2011-ED Procedimientos para el Desarrollo de Actividades de Capac...
Edwin Bazan Ambar
 
PDF
Social Design for Urban Change
Domenico Polimeno
 
PPTX
Lecture 9 data structures and algorithms
Aakash deep Singhal
 
PPTX
Большинство собственников не умеют управлять своими компаниями. Михаил Молоканов
STRADIS
 
PPTX
historia de madonna
97llunaferre
 
ODP
Madonna Open Office
davidara
 
PPT
Fisiologia - Sistema Respiratório 3
Pedro Miguel
 
PPT
3.4 selection sort
Krish_ver2
 
PPTX
Nutritional Rehabilitation
Kunal Modak
 
25 java tough interview questions
Arun Banotra
 
Java Sorting Algorithms
Brendan Campbell
 
Java programs - bubble sort, iterator, linked list, hash set, reverse string,...
Sunil Kumar Gunasekaran
 
Columna_bernik_Dic 2009pdf
Leticia Brando
 
私のちびっとタスク管理 - RxTstudy #6
komeshogu n
 
Boas práticas para manipulação de alimentos
Cleber Lima
 
UbD Sept 2016
Jacob Martens
 
Cuando las-mujeres-matan
julia ramirez
 
ゆるキャラから学んだもの
komeshogu n
 
Disneyから学んだこと
komeshogu n
 
企業研究〜コカ・コーラ株式会社〜
Koheichan
 
R.D Nº 0520 2011-ED Procedimientos para el Desarrollo de Actividades de Capac...
Edwin Bazan Ambar
 
Social Design for Urban Change
Domenico Polimeno
 
Lecture 9 data structures and algorithms
Aakash deep Singhal
 
Большинство собственников не умеют управлять своими компаниями. Михаил Молоканов
STRADIS
 
historia de madonna
97llunaferre
 
Madonna Open Office
davidara
 
Fisiologia - Sistema Respiratório 3
Pedro Miguel
 
3.4 selection sort
Krish_ver2
 
Nutritional Rehabilitation
Kunal Modak
 
Ad

Similar to 3 searching algorithms in Java (20)

PDF
Searching and Sorting Techniques in Data Structure
Balwant Gorad
 
PPTX
Presentation on Searching and Sorting in C language.pptx
Krishnanandmishra15
 
PPTX
Introduction to Searching Algorithm for beginners
JoshuaEddyson1
 
DOCX
PPS 5.5.BASIC ALGORITHMS SEARCHING (LINEAR SEARCH, BINARY SEARCH ETC.), BASI...
Sitamarhi Institute of Technology
 
PPT
Searching in c language
CHANDAN KUMAR
 
PPT
Searching algorithms
Trupti Agrawal
 
PPTX
Searching and Sorting Unit II Part I.pptx
Dr. Madhuri Jawale
 
PPTX
3.Problem Solving Techniques and Data Structures.pptx
Ganesh Bhosale
 
PPTX
Rahat &amp; juhith
Rj Juhith
 
PPTX
Unit 2 Searching and Sorting Technique.pptx
Vaibhav Parjane
 
PPTX
27631722026_T._TAJESWAR_RAO_PCC-CS301_CSE(CS).pptx
AyanMandal44
 
PPTX
Searching & Algorithms IN DATA STRUCTURES
RAKSHITDOGRA1
 
PDF
searching
A. S. M. Shafi
 
PPTX
unit 2 First.pptx Searching - Linear and Binary Search
Vaibhav Parjane
 
PPTX
Presentation
zohaib arif
 
DOCX
MODULE 5-Searching and-sorting
nikshaikh786
 
PPTX
Searching linear &amp; binary search
nikunjandy
 
PPTX
data_structure_Chapter two_computer.pptx
Mohammed472103
 
PPTX
Searching in Data Structure
raghavbirla63
 
PPTX
Searching and Sorting Algorithms in Data Structures
poongothai11
 
Searching and Sorting Techniques in Data Structure
Balwant Gorad
 
Presentation on Searching and Sorting in C language.pptx
Krishnanandmishra15
 
Introduction to Searching Algorithm for beginners
JoshuaEddyson1
 
PPS 5.5.BASIC ALGORITHMS SEARCHING (LINEAR SEARCH, BINARY SEARCH ETC.), BASI...
Sitamarhi Institute of Technology
 
Searching in c language
CHANDAN KUMAR
 
Searching algorithms
Trupti Agrawal
 
Searching and Sorting Unit II Part I.pptx
Dr. Madhuri Jawale
 
3.Problem Solving Techniques and Data Structures.pptx
Ganesh Bhosale
 
Rahat &amp; juhith
Rj Juhith
 
Unit 2 Searching and Sorting Technique.pptx
Vaibhav Parjane
 
27631722026_T._TAJESWAR_RAO_PCC-CS301_CSE(CS).pptx
AyanMandal44
 
Searching & Algorithms IN DATA STRUCTURES
RAKSHITDOGRA1
 
searching
A. S. M. Shafi
 
unit 2 First.pptx Searching - Linear and Binary Search
Vaibhav Parjane
 
Presentation
zohaib arif
 
MODULE 5-Searching and-sorting
nikshaikh786
 
Searching linear &amp; binary search
nikunjandy
 
data_structure_Chapter two_computer.pptx
Mohammed472103
 
Searching in Data Structure
raghavbirla63
 
Searching and Sorting Algorithms in Data Structures
poongothai11
 
Ad

More from Mahmoud Alfarra (20)

PPT
Computer Programming, Loops using Java - part 2
Mahmoud Alfarra
 
PPT
Computer Programming, Loops using Java
Mahmoud Alfarra
 
PPT
Chapter 10: hashing data structure
Mahmoud Alfarra
 
PPT
Chapter9 graph data structure
Mahmoud Alfarra
 
PPT
Chapter 8: tree data structure
Mahmoud Alfarra
 
PPT
Chapter 7: Queue data structure
Mahmoud Alfarra
 
PPT
Chapter 6: stack data structure
Mahmoud Alfarra
 
PPT
Chapter 5: linked list data structure
Mahmoud Alfarra
 
PPT
Chapter 4: basic search algorithms data structure
Mahmoud Alfarra
 
PPT
Chapter 3: basic sorting algorithms data structure
Mahmoud Alfarra
 
PPT
Chapter 2: array and array list data structure
Mahmoud Alfarra
 
PPT
Chapter1 intro toprincipleofc#_datastructure_b_cs
Mahmoud Alfarra
 
PPT
Chapter 0: introduction to data structure
Mahmoud Alfarra
 
PPTX
3 classification
Mahmoud Alfarra
 
PPT
8 programming-using-java decision-making practices 20102011
Mahmoud Alfarra
 
PPT
7 programming-using-java decision-making220102011
Mahmoud Alfarra
 
PPT
6 programming-using-java decision-making20102011-
Mahmoud Alfarra
 
PPT
5 programming-using-java intro-tooop20102011
Mahmoud Alfarra
 
PPT
4 programming-using-java intro-tojava20102011
Mahmoud Alfarra
 
PPT
3 programming-using-java introduction-to computer
Mahmoud Alfarra
 
Computer Programming, Loops using Java - part 2
Mahmoud Alfarra
 
Computer Programming, Loops using Java
Mahmoud Alfarra
 
Chapter 10: hashing data structure
Mahmoud Alfarra
 
Chapter9 graph data structure
Mahmoud Alfarra
 
Chapter 8: tree data structure
Mahmoud Alfarra
 
Chapter 7: Queue data structure
Mahmoud Alfarra
 
Chapter 6: stack data structure
Mahmoud Alfarra
 
Chapter 5: linked list data structure
Mahmoud Alfarra
 
Chapter 4: basic search algorithms data structure
Mahmoud Alfarra
 
Chapter 3: basic sorting algorithms data structure
Mahmoud Alfarra
 
Chapter 2: array and array list data structure
Mahmoud Alfarra
 
Chapter1 intro toprincipleofc#_datastructure_b_cs
Mahmoud Alfarra
 
Chapter 0: introduction to data structure
Mahmoud Alfarra
 
3 classification
Mahmoud Alfarra
 
8 programming-using-java decision-making practices 20102011
Mahmoud Alfarra
 
7 programming-using-java decision-making220102011
Mahmoud Alfarra
 
6 programming-using-java decision-making20102011-
Mahmoud Alfarra
 
5 programming-using-java intro-tooop20102011
Mahmoud Alfarra
 
4 programming-using-java intro-tojava20102011
Mahmoud Alfarra
 
3 programming-using-java introduction-to computer
Mahmoud Alfarra
 

Recently uploaded (20)

PDF
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
PPTX
DAY 1_QUARTER1 ENGLISH 5 WEEK- PRESENTATION.pptx
BanyMacalintal
 
PDF
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
PPTX
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
PDF
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
PPTX
Controller Request and Response in Odoo18
Celine George
 
PDF
Horarios de distribución de agua en julio
pegazohn1978
 
PDF
STATEMENT-BY-THE-HON.-MINISTER-FOR-HEALTH-ON-THE-COVID-19-OUTBREAK-AT-UG_revi...
nservice241
 
PDF
epi editorial commitee meeting presentation
MIPLM
 
PPTX
How to Configure Re-Ordering From Portal in Odoo 18 Website
Celine George
 
PDF
Mahidol_Change_Agent_Note_2025-06-27-29_MUSEF
Tassanee Lerksuthirat
 
PDF
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
PDF
Council of Chalcedon Re-Examined
Smiling Lungs
 
PPTX
infertility, types,causes, impact, and management
Ritu480198
 
PPTX
DIGITAL CITIZENSHIP TOPIC TLE 8 MATATAG CURRICULUM
ROBERTAUGUSTINEFRANC
 
PPTX
How to Manage Allocation Report for Manufacturing Orders in Odoo 18
Celine George
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PPTX
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
PPTX
TRANSLATIONAL AND ROTATIONAL MOTION.pptx
KIPAIZAGABAWA1
 
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
DAY 1_QUARTER1 ENGLISH 5 WEEK- PRESENTATION.pptx
BanyMacalintal
 
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
Controller Request and Response in Odoo18
Celine George
 
Horarios de distribución de agua en julio
pegazohn1978
 
STATEMENT-BY-THE-HON.-MINISTER-FOR-HEALTH-ON-THE-COVID-19-OUTBREAK-AT-UG_revi...
nservice241
 
epi editorial commitee meeting presentation
MIPLM
 
How to Configure Re-Ordering From Portal in Odoo 18 Website
Celine George
 
Mahidol_Change_Agent_Note_2025-06-27-29_MUSEF
Tassanee Lerksuthirat
 
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
Council of Chalcedon Re-Examined
Smiling Lungs
 
infertility, types,causes, impact, and management
Ritu480198
 
DIGITAL CITIZENSHIP TOPIC TLE 8 MATATAG CURRICULUM
ROBERTAUGUSTINEFRANC
 
How to Manage Allocation Report for Manufacturing Orders in Odoo 18
Celine George
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
TRANSLATIONAL AND ROTATIONAL MOTION.pptx
KIPAIZAGABAWA1
 

3 searching algorithms in Java

  • 1. using Java 2015 Data Structure Prepared by: Mahmoud Rafeek Al-farra in Java 3. Searching Algorithms
  • 2. mfarra.cst.ps www.fb.com/MahmoudRFarra Contents Which is best ? Binary Search approach Linear search approach Introduction
  • 3. Introduction mfarra.cst.ps www.fb.com/MahmoudRFarra  Searching for data is a fundamental computer programming task and one that has been studied for many years. There are two fundamental ways to search for data in a list: The sequential (linear) search approach. The binary search approuach.
  • 4. Linear search approach mfarra.cst.ps www.fb.com/MahmoudRFarra The linear search approach compares the key element sequentially with each element in the data structure.  It continues to do so until the key matches an element in the DS or the DS is exhausted without a match being found. If a match is made, the linear search returns the index of the element in the DS that matches the key.  If no match is found, the search returns -1.
  • 5. Linear search approach mfarra.cst.ps www.fb.com/MahmoudRFarra 2 5 81 88 90 997 9 34 55 56 66 79 80 1 2 3 4 5 6 7 8 9 10 11 12 13 Wanted = 80 array 0 ==‫؟‬ .... .... The wanted value at comparison number 10 and position 9 You can see an animated example from the following link: http://www.cs.armstrong.edu/liang/animation/web/LinearSearch.html
  • 6. Linear search approach mfarra.cst.ps www.fb.com/MahmoudRFarra 1. public class LinearSearch { 2. /** The method for finding a key in the list */ 3. public static int linearSearch(int[] list, int key) { 4. for (int i = 0; i < list.length; i++) { 5. if (key == list[i]) 6. return i; 7. } 8. return -1; 9. } 10. }
  • 7. Binary search approach mfarra.cst.ps www.fb.com/MahmoudRFarra When the records you are searching through are sorted into order, you can perform a more efficient search than the sequential search to find a value. This search is called a binary search. To use this algorithm, we first need our data stored in order (ascending, preferably) in an array. You can see an animated example from the following link: http://www.cs.armstrong.edu/liang/animation/web/BinarySearch.html
  • 8. Binary Search approach mfarra.cst.ps www.fb.com/MahmoudRFarra
  • 9. Binary Search approach 2 5 81 88 90 997 9 34 55 56 66 79 80 1 2 3 4 5 6 7 8 9 10 11 12 13 (0+13) / 2 = 6 If (array[6] == 80) return 6 Elseif (array[6] > 80) High = 6 -1 Else Low = 6+1 Middle = (low + high)/2 Wanted = 80 array 0 (7+13) / 2 = 10 If (array[10] == 80) return 10 Elseif (array[10] > 80) High = 10 -1 Else Low = 10+1 (7+9) / 2 = 8 If (array[8] == 80) return 8 Elseif (array[8] > 80) High = 8-1 Else Low = 8+1 1 2 3 mfarra.cst.ps www.fb.com/MahmoudRFarra
  • 10. Binary Search approach 2 5 81 88 90 997 9 34 55 56 66 79 80 1 2 3 4 5 6 7 8 9 10 11 12 13 Middle = (low + high)/2 Wanted = 80 array 0 (7+9) / 2 = 8 If (array[8] == 80) return 8 Elseif (array[8] > 80) High = 8-1 Else Low = 8+1 3 (9+9) / 2 = 9 If (array[9] == 80) return 8 Elseif (array[9] > 80) High = 9-1 Else Low = 9+1 4 return 8 mfarra.cst.ps www.fb.com/MahmoudRFarra
  • 11. Binary Search approach mfarra.cst.ps www.fb.com/MahmoudRFarra 1. public class BinarySearch { 2. public static int binarySearch(int[] list, int key) { 3. int low = 0; 4. int high = list.length - 1; 5. while (high >= low) { 6. int mid = (low + high) / 2; 7. if (key < list[mid]) 8. high = mid - 1; 9. else if (key == list[mid]) 10. return mid; 11. else 12. low = mid + 1; 13. } 14. return –low - 1; // Now high < low, key not found 15. } 16. }
  • 12. Which is best ? mfarra.cst.ps www.fb.com/MahmoudRFarra The best Complexity Data structure Suitable data Size of data
  • 13. Which is best ? mfarra.cst.ps www.fb.com/MahmoudRFarra  If an array is sorted, binary search is more efficient than linear search for finding an element in the array.  Linear search is useful for finding an element in a small array or an unsorted array, but it is inefficient for large arrays.  Binary search is more efficient, but it requires that the array be presorted.
  • 14. Which is best ? mfarra.cst.ps www.fb.com/MahmoudRFarra Complexity time of linear approach is: O(n) Complexity time of binary approach is: O( log(n))  Supported data structure of linear: ?  Supported data structure of Binary: ?
  • 15. using Java 2015 FB: M a h m o u d R F a r r a YouTube: M a h m o u d R F a r SlidesShare: mralfarra Thank you