SlideShare a Scribd company logo
1 of 1
Download to read offline
A) odd numbers case:
Sequential or linear search is a searching mechanism where every element one by one is
searched until the result is found.
where l is list and x is our search item.
Minimum number of sequential search comparisons = 1
Maximum number of sequential search comparisons = N
Average number of sequential search comparisons for successful searches = ½ N
To find the middle element we can use (biggest - smallest + 1)/ 2.
2)EVEN number case:.
if the array has even number of elements then divide the list into two subparts of equal size name
array1 array 2, the element which is immediately after array 1 is considered as mid element. so
the complexity even in this case if n/2.
3)
If we find the element in 1st position then comparisons = 1
2nd positions then 2. 3rd postion 3..... nth position = n so the average no of comparisons in linear
search is (1+2+3+4+5+6.....+n) = n(n+1)/2
Solution
A) odd numbers case:
Sequential or linear search is a searching mechanism where every element one by one is
searched until the result is found.
where l is list and x is our search item.
Minimum number of sequential search comparisons = 1
Maximum number of sequential search comparisons = N
Average number of sequential search comparisons for successful searches = ½ N
To find the middle element we can use (biggest - smallest + 1)/ 2.
2)EVEN number case:.
if the array has even number of elements then divide the list into two subparts of equal size name
array1 array 2, the element which is immediately after array 1 is considered as mid element. so
the complexity even in this case if n/2.
3)
If we find the element in 1st position then comparisons = 1
2nd positions then 2. 3rd postion 3..... nth position = n so the average no of comparisons in linear
search is (1+2+3+4+5+6.....+n) = n(n+1)/2

More Related Content

Similar to A) odd numbers caseSequential or linear search is a searching mec.pdf

27631722026_T._TAJESWAR_RAO_PCC-CS301_CSE(CS).pptx
27631722026_T._TAJESWAR_RAO_PCC-CS301_CSE(CS).pptx27631722026_T._TAJESWAR_RAO_PCC-CS301_CSE(CS).pptx
27631722026_T._TAJESWAR_RAO_PCC-CS301_CSE(CS).pptx
AyanMandal44
 
Searching Sorting
Searching SortingSearching Sorting
Searching Sorting
guest2cb109
 
DS - Unit 2 FINAL (2).pptx
DS - Unit 2 FINAL (2).pptxDS - Unit 2 FINAL (2).pptx
DS - Unit 2 FINAL (2).pptx
prakashvs7
 
Arrays
ArraysArrays
Arrays
uos
 

Similar to A) odd numbers caseSequential or linear search is a searching mec.pdf (20)

SEARCHING
SEARCHINGSEARCHING
SEARCHING
 
27631722026_T._TAJESWAR_RAO_PCC-CS301_CSE(CS).pptx
27631722026_T._TAJESWAR_RAO_PCC-CS301_CSE(CS).pptx27631722026_T._TAJESWAR_RAO_PCC-CS301_CSE(CS).pptx
27631722026_T._TAJESWAR_RAO_PCC-CS301_CSE(CS).pptx
 
Searching & Sorting Algorithms
Searching & Sorting AlgorithmsSearching & Sorting Algorithms
Searching & Sorting Algorithms
 
Searching
Searching Searching
Searching
 
Selection sort lab mannual
Selection sort lab mannualSelection sort lab mannual
Selection sort lab mannual
 
Searching Sorting
Searching SortingSearching Sorting
Searching Sorting
 
Linear Search
Linear SearchLinear Search
Linear Search
 
Unit v data structure-converted
Unit  v data structure-convertedUnit  v data structure-converted
Unit v data structure-converted
 
Searching techniques
Searching techniquesSearching techniques
Searching techniques
 
Data Structures_ Sorting & Searching
Data Structures_ Sorting & SearchingData Structures_ Sorting & Searching
Data Structures_ Sorting & Searching
 
DS - Unit 2 FINAL (2).pptx
DS - Unit 2 FINAL (2).pptxDS - Unit 2 FINAL (2).pptx
DS - Unit 2 FINAL (2).pptx
 
Sorting techniques
Sorting techniquesSorting techniques
Sorting techniques
 
Insertion and Redix Sort
Insertion and Redix SortInsertion and Redix Sort
Insertion and Redix Sort
 
Arrays
ArraysArrays
Arrays
 
Searching_Sorting.pptx
Searching_Sorting.pptxSearching_Sorting.pptx
Searching_Sorting.pptx
 
advanced searching and sorting.pdf
advanced searching and sorting.pdfadvanced searching and sorting.pdf
advanced searching and sorting.pdf
 
Searching
SearchingSearching
Searching
 
Binary Search
Binary SearchBinary Search
Binary Search
 
arrays
arraysarrays
arrays
 
Fibonacci search
Fibonacci searchFibonacci search
Fibonacci search
 

More from apleather

The below stated are the Challenges and business requirements faced .pdf
The below stated are the Challenges and business requirements faced .pdfThe below stated are the Challenges and business requirements faced .pdf
The below stated are the Challenges and business requirements faced .pdf
apleather
 
Form1.csusing System; using System.Collections.Generic; using .pdf
Form1.csusing System; using System.Collections.Generic; using .pdfForm1.csusing System; using System.Collections.Generic; using .pdf
Form1.csusing System; using System.Collections.Generic; using .pdf
apleather
 
Influenza A The recently raised awareness of th.pdf
                     Influenza A  The recently raised awareness of th.pdf                     Influenza A  The recently raised awareness of th.pdf
Influenza A The recently raised awareness of th.pdf
apleather
 
Data warehousing has quickly evolved into a unique and popular busin.pdf
Data warehousing has quickly evolved into a unique and popular busin.pdfData warehousing has quickly evolved into a unique and popular busin.pdf
Data warehousing has quickly evolved into a unique and popular busin.pdf
apleather
 

More from apleather (20)

pH = -log[H+] pH = -log(0.5) pH = 0.301 .pdf
                     pH = -log[H+]  pH = -log(0.5)  pH = 0.301        .pdf                     pH = -log[H+]  pH = -log(0.5)  pH = 0.301        .pdf
pH = -log[H+] pH = -log(0.5) pH = 0.301 .pdf
 
The universality of the genetic code provides strong support for the.pdf
The universality of the genetic code provides strong support for the.pdfThe universality of the genetic code provides strong support for the.pdf
The universality of the genetic code provides strong support for the.pdf
 
The pus is consists of neutrophils which target the pathogen. The pa.pdf
The pus is consists of neutrophils which target the pathogen. The pa.pdfThe pus is consists of neutrophils which target the pathogen. The pa.pdf
The pus is consists of neutrophils which target the pathogen. The pa.pdf
 
The least soluble gas is N2 because it is inert and cannot form any .pdf
The least soluble gas is N2 because it is inert and cannot form any .pdfThe least soluble gas is N2 because it is inert and cannot form any .pdf
The least soluble gas is N2 because it is inert and cannot form any .pdf
 
The below stated are the Challenges and business requirements faced .pdf
The below stated are the Challenges and business requirements faced .pdfThe below stated are the Challenges and business requirements faced .pdf
The below stated are the Challenges and business requirements faced .pdf
 
Sometimes CEO can also hold the position of Chairperson, but in some.pdf
Sometimes CEO can also hold the position of Chairperson, but in some.pdfSometimes CEO can also hold the position of Chairperson, but in some.pdf
Sometimes CEO can also hold the position of Chairperson, but in some.pdf
 
SolutionInorder traversal It will consider left child root, and .pdf
SolutionInorder traversal It will consider left child root, and .pdfSolutionInorder traversal It will consider left child root, and .pdf
SolutionInorder traversal It will consider left child root, and .pdf
 
In a side the length of sides are same. use this property iterativel.pdf
In a side the length of sides are same. use this property iterativel.pdfIn a side the length of sides are same. use this property iterativel.pdf
In a side the length of sides are same. use this property iterativel.pdf
 
Elements or steps of acceptance testingSolutionElements or ste.pdf
Elements or steps of acceptance testingSolutionElements or ste.pdfElements or steps of acceptance testingSolutionElements or ste.pdf
Elements or steps of acceptance testingSolutionElements or ste.pdf
 
Long term capital = Common stock + shareholders equity + Retained ea.pdf
Long term capital = Common stock + shareholders equity + Retained ea.pdfLong term capital = Common stock + shareholders equity + Retained ea.pdf
Long term capital = Common stock + shareholders equity + Retained ea.pdf
 
Limbs evolve so frequently that it is impossible to determine otherw.pdf
Limbs evolve so frequently that it is impossible to determine otherw.pdfLimbs evolve so frequently that it is impossible to determine otherw.pdf
Limbs evolve so frequently that it is impossible to determine otherw.pdf
 
hmmSolutionhmm.pdf
hmmSolutionhmm.pdfhmmSolutionhmm.pdf
hmmSolutionhmm.pdf
 
Form1.csusing System; using System.Collections.Generic; using .pdf
Form1.csusing System; using System.Collections.Generic; using .pdfForm1.csusing System; using System.Collections.Generic; using .pdf
Form1.csusing System; using System.Collections.Generic; using .pdf
 
Influenza A The recently raised awareness of th.pdf
                     Influenza A  The recently raised awareness of th.pdf                     Influenza A  The recently raised awareness of th.pdf
Influenza A The recently raised awareness of th.pdf
 
I believe its named Methyl iodide. You wouldn.pdf
                     I believe its named Methyl iodide. You wouldn.pdf                     I believe its named Methyl iodide. You wouldn.pdf
I believe its named Methyl iodide. You wouldn.pdf
 
Data warehousing has quickly evolved into a unique and popular busin.pdf
Data warehousing has quickly evolved into a unique and popular busin.pdfData warehousing has quickly evolved into a unique and popular busin.pdf
Data warehousing has quickly evolved into a unique and popular busin.pdf
 
balready postedSolutionbalready posted.pdf
balready postedSolutionbalready posted.pdfbalready postedSolutionbalready posted.pdf
balready postedSolutionbalready posted.pdf
 
Assume the graph is strongly connected.SolutionAssume the grap.pdf
Assume the graph is strongly connected.SolutionAssume the grap.pdfAssume the graph is strongly connected.SolutionAssume the grap.pdf
Assume the graph is strongly connected.SolutionAssume the grap.pdf
 
Half life is the time in which the compound reduc.pdf
                     Half life is the time in which the compound reduc.pdf                     Half life is the time in which the compound reduc.pdf
Half life is the time in which the compound reduc.pdf
 
from the given reaction, order NO3=1 overall orde.pdf
                     from the given reaction, order NO3=1 overall orde.pdf                     from the given reaction, order NO3=1 overall orde.pdf
from the given reaction, order NO3=1 overall orde.pdf
 

Recently uploaded

Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
EADTU
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
Peter Brusilovsky
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
EADTU
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
中 央社
 

Recently uploaded (20)

Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
Trauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical PrinciplesTrauma-Informed Leadership - Five Practical Principles
Trauma-Informed Leadership - Five Practical Principles
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
Book Review of Run For Your Life Powerpoint
Book Review of Run For Your Life PowerpointBook Review of Run For Your Life Powerpoint
Book Review of Run For Your Life Powerpoint
 
Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"Mattingly "AI & Prompt Design: Named Entity Recognition"
Mattingly "AI & Prompt Design: Named Entity Recognition"
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
SPLICE Working Group: Reusable Code Examples
SPLICE Working Group:Reusable Code ExamplesSPLICE Working Group:Reusable Code Examples
SPLICE Working Group: Reusable Code Examples
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptx
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
Supporting Newcomer Multilingual Learners
Supporting Newcomer  Multilingual LearnersSupporting Newcomer  Multilingual Learners
Supporting Newcomer Multilingual Learners
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptx
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 

A) odd numbers caseSequential or linear search is a searching mec.pdf

  • 1. A) odd numbers case: Sequential or linear search is a searching mechanism where every element one by one is searched until the result is found. where l is list and x is our search item. Minimum number of sequential search comparisons = 1 Maximum number of sequential search comparisons = N Average number of sequential search comparisons for successful searches = ½ N To find the middle element we can use (biggest - smallest + 1)/ 2. 2)EVEN number case:. if the array has even number of elements then divide the list into two subparts of equal size name array1 array 2, the element which is immediately after array 1 is considered as mid element. so the complexity even in this case if n/2. 3) If we find the element in 1st position then comparisons = 1 2nd positions then 2. 3rd postion 3..... nth position = n so the average no of comparisons in linear search is (1+2+3+4+5+6.....+n) = n(n+1)/2 Solution A) odd numbers case: Sequential or linear search is a searching mechanism where every element one by one is searched until the result is found. where l is list and x is our search item. Minimum number of sequential search comparisons = 1 Maximum number of sequential search comparisons = N Average number of sequential search comparisons for successful searches = ½ N To find the middle element we can use (biggest - smallest + 1)/ 2. 2)EVEN number case:. if the array has even number of elements then divide the list into two subparts of equal size name array1 array 2, the element which is immediately after array 1 is considered as mid element. so the complexity even in this case if n/2. 3) If we find the element in 1st position then comparisons = 1 2nd positions then 2. 3rd postion 3..... nth position = n so the average no of comparisons in linear search is (1+2+3+4+5+6.....+n) = n(n+1)/2