Linear Search
Presentation on
Submitted by:
Markajul Hasnain Alif
ID: 161-35-139
Contents
Definitions (Data, Structure, Data Structure, Search, Linear
search)
Example
Pseudocode
Advantages and disadvantages
Discussion
And Sources
Linear Search
Presentation on
What is data?
Data is a collection of facts, such as numbers, words,
measurements, observations or even just descriptions
of things.
Linear Search
Presentation on
What is
structure?
The arrangement of and relations between the parts or
elements of something complex.
Linear Search
Presentation on
What is data
structure?
data structure is a specialized format for organizing
and storing data.
Linear Search
Presentation on
What is search?
Search is the process of looking for something.
Linear Search
Presentation on
What is linear
search?
linear search or sequential search is a method for
finding a target value within a list. It sequentially checks
each element of the list for the target value until a
match is found or until all the elements have been
searched.
Linear Search
Presentation on
Linear search
example
If you are asked to find the name of the person having
phone number say “1234” with the help of a telephone
directory.
Since telephone directory is sorted by name not by
numbers,we have to go through each and every
number of the directory
Linear Search
Presentation on
Pseudocode
For all elements
Check if it is equal to element being searched
for.
If it is, return its position.
else continue.
Linear Search
Presentation on
Example
Linear Search
Presentation on
Advantages
⦿ If the first number in the directory is the number you were
searching for ,then lucky you!!.
⦿ Since you have found it on the very first page,now its not
important for you that how many pages are there in the
directory.
⦿ Whether if it is of 1000 pages or 2000 pages it will take u
same time to find you the number ,if it is at the very
beginning .
.
Linear Search
Presentation on
Disadvantages
⦿ It may happen that the number you are searching for is the
last number of directory or if it is not in the directory at all.
⦿ In that case you have to search the whole directory.
⦿ Now number of elements will matter to you.if there are 500
pages ,you have to search 500;if it has 1000 you have to
search 1000.
Linear Search
Presentation on
Discussion
⦿ Sorted array is not needed.
⦿ Works fine for small number of elements .Search
time increases with number of elements.
⦿ Elements with higher probability of being searched
should be kept in the beginning.
Linear Search
Presentation on
Sources
Google.com
Wikipedia.org
Slideshare.net
www.cse.ust.hk
hellohasan.com
Linear Search
Presentation on
Thank you all.
Linear Search
Presentation on

Linear Search Presentation

  • 1.
    Linear Search Presentation on Submittedby: Markajul Hasnain Alif ID: 161-35-139
  • 2.
    Contents Definitions (Data, Structure,Data Structure, Search, Linear search) Example Pseudocode Advantages and disadvantages Discussion And Sources Linear Search Presentation on
  • 3.
    What is data? Datais a collection of facts, such as numbers, words, measurements, observations or even just descriptions of things. Linear Search Presentation on
  • 4.
    What is structure? The arrangementof and relations between the parts or elements of something complex. Linear Search Presentation on
  • 5.
    What is data structure? datastructure is a specialized format for organizing and storing data. Linear Search Presentation on
  • 6.
    What is search? Searchis the process of looking for something. Linear Search Presentation on
  • 7.
    What is linear search? linearsearch or sequential search is a method for finding a target value within a list. It sequentially checks each element of the list for the target value until a match is found or until all the elements have been searched. Linear Search Presentation on
  • 8.
    Linear search example If youare asked to find the name of the person having phone number say “1234” with the help of a telephone directory. Since telephone directory is sorted by name not by numbers,we have to go through each and every number of the directory Linear Search Presentation on
  • 9.
    Pseudocode For all elements Checkif it is equal to element being searched for. If it is, return its position. else continue. Linear Search Presentation on
  • 10.
  • 11.
    Advantages ⦿ If thefirst number in the directory is the number you were searching for ,then lucky you!!. ⦿ Since you have found it on the very first page,now its not important for you that how many pages are there in the directory. ⦿ Whether if it is of 1000 pages or 2000 pages it will take u same time to find you the number ,if it is at the very beginning . . Linear Search Presentation on
  • 12.
    Disadvantages ⦿ It mayhappen that the number you are searching for is the last number of directory or if it is not in the directory at all. ⦿ In that case you have to search the whole directory. ⦿ Now number of elements will matter to you.if there are 500 pages ,you have to search 500;if it has 1000 you have to search 1000. Linear Search Presentation on
  • 13.
    Discussion ⦿ Sorted arrayis not needed. ⦿ Works fine for small number of elements .Search time increases with number of elements. ⦿ Elements with higher probability of being searched should be kept in the beginning. Linear Search Presentation on
  • 14.
  • 15.
    Thank you all. LinearSearch Presentation on