SlideShare une entreprise Scribd logo
1  sur  21
Mehedi Hassan
161-15-7667
Arafat Rahman
152-15-5983
Nazmul Islam 152-
15-5652
Taijul Islam 152-
15-5613
Name :
Ms. Rifat Ara Shams
Designation :
Senior Lecturer
Department :
Department of
Computer Science and
Engineering
E-mail :
rifat.cse@diu.edu.bd
Cell-Phone :
+880-1723256560
LINEAR BINARY
SEARCH
LINEAR SEARCH
10 46 8 996 2 34 19578
ENTER THE ARRAY ELEMENTS
ENTER THE NUMBER TO BE SEARCHED
2
M[0] M[1] M[2] M[3] M[4] M[5] M[6] M{7] M[8] M[9]
LINEAR SEARCH
10 46 8 996 2 34 19578
2 2 2 2 2 2
THE NUMBER IS FOUND IN THE 6TH
POSITION
#include <stdio.h>
int main()
{
int array[100], search, c, n;
printf("Enter the number of elements in
arrayn");
scanf("%d",&n);
printf("Enter %d integer(s)n", n);
for (c = 0; c < n; c++)
scanf("%d", &array[c]);
CODE
printf("Enter the number to searchn");
scanf("%d", &search);
for (c = 0; c < n; c++)
{
if (array[c] == search) /* if required
element found */
{
printf("%d is present at location
%d.n", search, c+1);
break;
}
}
if (c == n)
printf("%d is not present in array.n",
search);
return 0;
}
BINARY SEARCH
1 5 8 2412 36 48 876754
ENTER THE ARRAY ELEMENTS
ENTER THE NUMBER TO BE SEARCHED
36
M[0] M[1] M[2] M[3] M[4] M[5] M[6] M{7] M[8] M[9]
BINARY SEARCH
1 5 8 2412 36 48 876754
ENTER THE ARRAY ELEMENTS
ENTER THE NUMBER TO BE SEARCHED 36
M[0] M[1] M[2] M[3] M[4] M[5] M[6] M{7] M[8] M[9]
LB UB
P=LB+UB/2
24
STEP 1
FIND THE MIDDLE ELEMENT
P=0+9/2
24 36<
36 48 54 67 87
THE SEARCH ELEMENT LIES IN THE UB
0 1 2 3 4
COMPARING SEARCH WITH MIDDLE ELEMENT
STEP 2
P=LB+UB/2 54
54 > 36
36 48
STEP 3
DIVIDE THE ARRAY FURTHER
COMPARING SEARCH WITH MIDDLE ELEMENT
THE SEARCH ELEMENT LIES IN THE LB
3636
=
NUMBER FOUND
STEP 4
36 48
MIDDLE ELEMENT IS COMPARED WITH THE ELEMENTS IN THE ARRAY
#include<stdio.h>
int main(){
int a[10],i,n,m,c=0,l,u,mid;
printf("Enter the size of an
array: ");
scanf("%d",&n);
printf("Enter the elements in
ascending order: ");
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
printf("Enter the number to be
search: ");
scanf("%d",&m);
CODE
l=0,u=n-1;
while(l<=u){
mid=(l+u)/2;
if(m==a[mid]){
c=1;
break;
}
else if(m<a[mid]){
u=mid-1;
}
else
l=mid+1;
}
if(c==0)
printf("The number is not found.");
else
printf("The number is found.");
return 0;
}
Enter the elements of the array in ascending order
12
Enter the elements of the array in ascending order
23
Enter the elements of the array in ascending order
34
Enter the elements of the array in ascending order
45
Enter the elements of the array in ascending order
56
Enter the elements of the array in ascending order
67
Enter the elements of the array in ascending order
78
Enter the elements of the array in ascending order
89
Enter the elements of the array in ascending order
98
Enter the elements of the array in ascending order
100
Enter the number to be searched
67
found
Search
Search

Contenu connexe

Tendances

Implement a queue using two stacks.
Implement a queue using two stacks.Implement a queue using two stacks.
Implement a queue using two stacks.Dr. Loganathan R
 
Bcsl 033 data and file structures lab s3-3
Bcsl 033 data and file structures lab s3-3Bcsl 033 data and file structures lab s3-3
Bcsl 033 data and file structures lab s3-3Dr. Loganathan R
 
Bcsl 033 data and file structures lab s2-2
Bcsl 033 data and file structures lab s2-2Bcsl 033 data and file structures lab s2-2
Bcsl 033 data and file structures lab s2-2Dr. Loganathan R
 
C programming codes for the class assignment
C programming codes for the class assignmentC programming codes for the class assignment
C programming codes for the class assignmentZenith SVG
 
Bcsl 033 data and file structures lab s5-3
Bcsl 033 data and file structures lab s5-3Bcsl 033 data and file structures lab s5-3
Bcsl 033 data and file structures lab s5-3Dr. Loganathan R
 
Bcsl 033 data and file structures lab s1-3
Bcsl 033 data and file structures lab s1-3Bcsl 033 data and file structures lab s1-3
Bcsl 033 data and file structures lab s1-3Dr. Loganathan R
 
คำสั่ง Do while
คำสั่ง Do whileคำสั่ง Do while
คำสั่ง Do whilekramsri
 
Runge kutta C programme
Runge kutta C programmeRunge kutta C programme
Runge kutta C programmeShah Keval
 
Bcsl 033 data and file structures lab s5-2
Bcsl 033 data and file structures lab s5-2Bcsl 033 data and file structures lab s5-2
Bcsl 033 data and file structures lab s5-2Dr. Loganathan R
 

Tendances (19)

Implement a queue using two stacks.
Implement a queue using two stacks.Implement a queue using two stacks.
Implement a queue using two stacks.
 
Bcsl 033 data and file structures lab s3-3
Bcsl 033 data and file structures lab s3-3Bcsl 033 data and file structures lab s3-3
Bcsl 033 data and file structures lab s3-3
 
Bcsl 033 data and file structures lab s2-2
Bcsl 033 data and file structures lab s2-2Bcsl 033 data and file structures lab s2-2
Bcsl 033 data and file structures lab s2-2
 
C programming codes for the class assignment
C programming codes for the class assignmentC programming codes for the class assignment
C programming codes for the class assignment
 
Spiral array
Spiral arraySpiral array
Spiral array
 
Matlab lab exe
Matlab lab exeMatlab lab exe
Matlab lab exe
 
Bcsl 033 data and file structures lab s5-3
Bcsl 033 data and file structures lab s5-3Bcsl 033 data and file structures lab s5-3
Bcsl 033 data and file structures lab s5-3
 
Bcsl 033 data and file structures lab s1-3
Bcsl 033 data and file structures lab s1-3Bcsl 033 data and file structures lab s1-3
Bcsl 033 data and file structures lab s1-3
 
Decorator Design Pattern in C#
Decorator Design Pattern in C#Decorator Design Pattern in C#
Decorator Design Pattern in C#
 
201801 CSE240 Lecture 11
201801 CSE240 Lecture 11201801 CSE240 Lecture 11
201801 CSE240 Lecture 11
 
คำสั่ง Do while
คำสั่ง Do whileคำสั่ง Do while
คำสั่ง Do while
 
Singleton Design Pattern in C#
Singleton Design Pattern in C#Singleton Design Pattern in C#
Singleton Design Pattern in C#
 
Core 3 Functions 2
Core 3 Functions 2Core 3 Functions 2
Core 3 Functions 2
 
week-8x
week-8xweek-8x
week-8x
 
10 2 배열 응용
10 2 배열 응용10 2 배열 응용
10 2 배열 응용
 
programs
programsprograms
programs
 
Runge kutta C programme
Runge kutta C programmeRunge kutta C programme
Runge kutta C programme
 
Bcsl 033 data and file structures lab s5-2
Bcsl 033 data and file structures lab s5-2Bcsl 033 data and file structures lab s5-2
Bcsl 033 data and file structures lab s5-2
 
Insertion sort
Insertion sortInsertion sort
Insertion sort
 

En vedette

Mixx2016_Ануреев_Дмитрий
Mixx2016_Ануреев_ДмитрийMixx2016_Ануреев_Дмитрий
Mixx2016_Ануреев_Дмитрийiabrussiaprez
 
Tecnicas de evaluacion de proyectos
Tecnicas de evaluacion de proyectosTecnicas de evaluacion de proyectos
Tecnicas de evaluacion de proyectosJavier Garcia
 
Adapting our API for multiple platforms
Adapting our API for multiple platformsAdapting our API for multiple platforms
Adapting our API for multiple platformsRouven Weßling
 
Storyboard title sequence (1)
Storyboard title sequence (1)Storyboard title sequence (1)
Storyboard title sequence (1)Annika Laws-Walsh
 
Indice libro "SEO e SEM Guida Avanzata al Web Marketing" 4° Edizione
Indice libro "SEO e SEM Guida Avanzata al Web Marketing" 4° EdizioneIndice libro "SEO e SEM Guida Avanzata al Web Marketing" 4° Edizione
Indice libro "SEO e SEM Guida Avanzata al Web Marketing" 4° EdizioneLibro SEO
 
CIM Formación - Fitoterapia para los trastornos del sistema nervioso
CIM Formación - Fitoterapia para los trastornos del sistema nerviosoCIM Formación - Fitoterapia para los trastornos del sistema nervioso
CIM Formación - Fitoterapia para los trastornos del sistema nerviosoCIM Grupo de Formación
 

En vedette (11)

Mixx2016_Ануреев_Дмитрий
Mixx2016_Ануреев_ДмитрийMixx2016_Ануреев_Дмитрий
Mixx2016_Ануреев_Дмитрий
 
Suquet de peix
Suquet de peixSuquet de peix
Suquet de peix
 
Cmsascode
CmsascodeCmsascode
Cmsascode
 
Tecnicas de evaluacion de proyectos
Tecnicas de evaluacion de proyectosTecnicas de evaluacion de proyectos
Tecnicas de evaluacion de proyectos
 
Adapting our API for multiple platforms
Adapting our API for multiple platformsAdapting our API for multiple platforms
Adapting our API for multiple platforms
 
Kendra Shot List
Kendra Shot ListKendra Shot List
Kendra Shot List
 
Storyboard title sequence (1)
Storyboard title sequence (1)Storyboard title sequence (1)
Storyboard title sequence (1)
 
Idioms and fixed expressions (i)
Idioms and fixed expressions (i)Idioms and fixed expressions (i)
Idioms and fixed expressions (i)
 
Phrasal verbs and Idioms Quiz FCE
Phrasal verbs and Idioms Quiz FCEPhrasal verbs and Idioms Quiz FCE
Phrasal verbs and Idioms Quiz FCE
 
Indice libro "SEO e SEM Guida Avanzata al Web Marketing" 4° Edizione
Indice libro "SEO e SEM Guida Avanzata al Web Marketing" 4° EdizioneIndice libro "SEO e SEM Guida Avanzata al Web Marketing" 4° Edizione
Indice libro "SEO e SEM Guida Avanzata al Web Marketing" 4° Edizione
 
CIM Formación - Fitoterapia para los trastornos del sistema nervioso
CIM Formación - Fitoterapia para los trastornos del sistema nerviosoCIM Formación - Fitoterapia para los trastornos del sistema nervioso
CIM Formación - Fitoterapia para los trastornos del sistema nervioso
 

Similaire à Search

Computer Science Practical Science C++ with SQL commands
Computer Science Practical Science C++ with SQL commandsComputer Science Practical Science C++ with SQL commands
Computer Science Practical Science C++ with SQL commandsVishvjeet Yadav
 
Sequential & binary, linear search
Sequential & binary, linear searchSequential & binary, linear search
Sequential & binary, linear searchmontazur420
 
Data Structures Using C Practical File
Data Structures Using C Practical File Data Structures Using C Practical File
Data Structures Using C Practical File Rahul Chugh
 
Data structure new lab manual
Data structure  new lab manualData structure  new lab manual
Data structure new lab manualSANTOSH RATH
 
ARRAY in python and c with examples .pptx
ARRAY  in python and c with examples .pptxARRAY  in python and c with examples .pptx
ARRAY in python and c with examples .pptxabhishekmaurya102515
 
Singly linked list.pptx
Singly linked list.pptxSingly linked list.pptx
Singly linked list.pptxSanthiya S
 
‏‏chap6 list tuples.pptx
‏‏chap6 list tuples.pptx‏‏chap6 list tuples.pptx
‏‏chap6 list tuples.pptxRamiHarrathi1
 
Data Structures- Part3 arrays and searching algorithms
Data Structures- Part3 arrays and searching algorithmsData Structures- Part3 arrays and searching algorithms
Data Structures- Part3 arrays and searching algorithmsAbdullah Al-hazmy
 
DATA STRUCTURE CLASS 12 COMPUTER SCIENCE
DATA STRUCTURE CLASS 12 COMPUTER SCIENCEDATA STRUCTURE CLASS 12 COMPUTER SCIENCE
DATA STRUCTURE CLASS 12 COMPUTER SCIENCEDev Chauhan
 
03 Linear Arrays Memory Representations .pdf
03 Linear Arrays Memory Representations .pdf03 Linear Arrays Memory Representations .pdf
03 Linear Arrays Memory Representations .pdfKkSingh64
 
design and analysis of algorithm Lab files
design and analysis of algorithm Lab filesdesign and analysis of algorithm Lab files
design and analysis of algorithm Lab filesNitesh Dubey
 
Sorting programs
Sorting programsSorting programs
Sorting programsVarun Garg
 

Similaire à Search (20)

Arrays
ArraysArrays
Arrays
 
Computer Science Practical Science C++ with SQL commands
Computer Science Practical Science C++ with SQL commandsComputer Science Practical Science C++ with SQL commands
Computer Science Practical Science C++ with SQL commands
 
Sequential & binary, linear search
Sequential & binary, linear searchSequential & binary, linear search
Sequential & binary, linear search
 
DSC program.pdf
DSC program.pdfDSC program.pdf
DSC program.pdf
 
Data Structures Using C Practical File
Data Structures Using C Practical File Data Structures Using C Practical File
Data Structures Using C Practical File
 
unit-2-dsa.pptx
unit-2-dsa.pptxunit-2-dsa.pptx
unit-2-dsa.pptx
 
2D array
2D array2D array
2D array
 
Data structure new lab manual
Data structure  new lab manualData structure  new lab manual
Data structure new lab manual
 
ARRAY in python and c with examples .pptx
ARRAY  in python and c with examples .pptxARRAY  in python and c with examples .pptx
ARRAY in python and c with examples .pptx
 
C programs
C programsC programs
C programs
 
Arrays in C
Arrays in CArrays in C
Arrays in C
 
Pnno
PnnoPnno
Pnno
 
Singly linked list.pptx
Singly linked list.pptxSingly linked list.pptx
Singly linked list.pptx
 
‏‏chap6 list tuples.pptx
‏‏chap6 list tuples.pptx‏‏chap6 list tuples.pptx
‏‏chap6 list tuples.pptx
 
Data Structures- Part3 arrays and searching algorithms
Data Structures- Part3 arrays and searching algorithmsData Structures- Part3 arrays and searching algorithms
Data Structures- Part3 arrays and searching algorithms
 
DATA STRUCTURE CLASS 12 COMPUTER SCIENCE
DATA STRUCTURE CLASS 12 COMPUTER SCIENCEDATA STRUCTURE CLASS 12 COMPUTER SCIENCE
DATA STRUCTURE CLASS 12 COMPUTER SCIENCE
 
03 Linear Arrays Memory Representations .pdf
03 Linear Arrays Memory Representations .pdf03 Linear Arrays Memory Representations .pdf
03 Linear Arrays Memory Representations .pdf
 
design and analysis of algorithm Lab files
design and analysis of algorithm Lab filesdesign and analysis of algorithm Lab files
design and analysis of algorithm Lab files
 
Report 02(Binary Search)
Report 02(Binary Search)Report 02(Binary Search)
Report 02(Binary Search)
 
Sorting programs
Sorting programsSorting programs
Sorting programs
 

Plus de Daffodil International University (20)

Bresenham algorithm
Bresenham algorithmBresenham algorithm
Bresenham algorithm
 
Tic Tac Toe
Tic Tac ToeTic Tac Toe
Tic Tac Toe
 
The Waterfall Model & RAD MODEL
 The Waterfall Model &  RAD MODEL The Waterfall Model &  RAD MODEL
The Waterfall Model & RAD MODEL
 
Reinforcement learning
Reinforcement learningReinforcement learning
Reinforcement learning
 
online marketing
online marketingonline marketing
online marketing
 
normalization
normalizationnormalization
normalization
 
Bioinformatics lesson
Bioinformatics lessonBioinformatics lesson
Bioinformatics lesson
 
Blasta
BlastaBlasta
Blasta
 
Bioinformatics lesson
Bioinformatics lessonBioinformatics lesson
Bioinformatics lesson
 
Liver
LiverLiver
Liver
 
Numerical methods
Numerical methodsNumerical methods
Numerical methods
 
stack in assembally language
stack in assembally languagestack in assembally language
stack in assembally language
 
OSI Model
OSI ModelOSI Model
OSI Model
 
Topology
TopologyTopology
Topology
 
Complex number
Complex numberComplex number
Complex number
 
Ahsan Manzil
Ahsan Manzil Ahsan Manzil
Ahsan Manzil
 
Big data
Big dataBig data
Big data
 
Encoders
EncodersEncoders
Encoders
 
Applications of numerical methods
Applications of numerical methodsApplications of numerical methods
Applications of numerical methods
 
Finite difference &amp; interpolation
Finite difference &amp; interpolationFinite difference &amp; interpolation
Finite difference &amp; interpolation
 

Dernier

4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxJanEmmanBrigoli
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsRommel Regala
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxRosabel UA
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 

Dernier (20)

4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptx
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World Politics
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Presentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptxPresentation Activity 2. Unit 3 transv.pptx
Presentation Activity 2. Unit 3 transv.pptx
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 

Search

  • 1.
  • 2. Mehedi Hassan 161-15-7667 Arafat Rahman 152-15-5983 Nazmul Islam 152- 15-5652 Taijul Islam 152- 15-5613
  • 3. Name : Ms. Rifat Ara Shams Designation : Senior Lecturer Department : Department of Computer Science and Engineering E-mail : rifat.cse@diu.edu.bd Cell-Phone : +880-1723256560
  • 4.
  • 6. LINEAR SEARCH 10 46 8 996 2 34 19578 ENTER THE ARRAY ELEMENTS ENTER THE NUMBER TO BE SEARCHED 2 M[0] M[1] M[2] M[3] M[4] M[5] M[6] M{7] M[8] M[9]
  • 7. LINEAR SEARCH 10 46 8 996 2 34 19578 2 2 2 2 2 2 THE NUMBER IS FOUND IN THE 6TH POSITION
  • 8. #include <stdio.h> int main() { int array[100], search, c, n; printf("Enter the number of elements in arrayn"); scanf("%d",&n); printf("Enter %d integer(s)n", n); for (c = 0; c < n; c++) scanf("%d", &array[c]); CODE
  • 9. printf("Enter the number to searchn"); scanf("%d", &search); for (c = 0; c < n; c++) { if (array[c] == search) /* if required element found */ { printf("%d is present at location %d.n", search, c+1); break; } } if (c == n) printf("%d is not present in array.n", search); return 0; }
  • 10.
  • 11. BINARY SEARCH 1 5 8 2412 36 48 876754 ENTER THE ARRAY ELEMENTS ENTER THE NUMBER TO BE SEARCHED 36 M[0] M[1] M[2] M[3] M[4] M[5] M[6] M{7] M[8] M[9]
  • 12. BINARY SEARCH 1 5 8 2412 36 48 876754 ENTER THE ARRAY ELEMENTS ENTER THE NUMBER TO BE SEARCHED 36 M[0] M[1] M[2] M[3] M[4] M[5] M[6] M{7] M[8] M[9] LB UB
  • 13. P=LB+UB/2 24 STEP 1 FIND THE MIDDLE ELEMENT P=0+9/2
  • 14. 24 36< 36 48 54 67 87 THE SEARCH ELEMENT LIES IN THE UB 0 1 2 3 4 COMPARING SEARCH WITH MIDDLE ELEMENT STEP 2
  • 15. P=LB+UB/2 54 54 > 36 36 48 STEP 3 DIVIDE THE ARRAY FURTHER COMPARING SEARCH WITH MIDDLE ELEMENT THE SEARCH ELEMENT LIES IN THE LB
  • 16. 3636 = NUMBER FOUND STEP 4 36 48 MIDDLE ELEMENT IS COMPARED WITH THE ELEMENTS IN THE ARRAY
  • 17. #include<stdio.h> int main(){ int a[10],i,n,m,c=0,l,u,mid; printf("Enter the size of an array: "); scanf("%d",&n); printf("Enter the elements in ascending order: "); for(i=0;i<n;i++){ scanf("%d",&a[i]); } printf("Enter the number to be search: "); scanf("%d",&m); CODE
  • 19. Enter the elements of the array in ascending order 12 Enter the elements of the array in ascending order 23 Enter the elements of the array in ascending order 34 Enter the elements of the array in ascending order 45 Enter the elements of the array in ascending order 56 Enter the elements of the array in ascending order 67 Enter the elements of the array in ascending order 78 Enter the elements of the array in ascending order 89 Enter the elements of the array in ascending order 98 Enter the elements of the array in ascending order 100 Enter the number to be searched 67 found