• Post Reply Bookmark Topic Watch Topic
  • New Topic

What is Linear Search?  RSS feed

 
Lindsey Brooks
Ranch Hand
Posts: 58
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone!

             I don't understand what Linear Search is. I searched
up online in Wikipedia and other websites but still don't understand
what it is. Anyone mind explaining what it is in a very simple way.

Thanks
 
Carey Brown
Saloon Keeper
Posts: 3329
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Google it. Lots of info.
 
Swastik Dey
Rancher
Posts: 1815
15
Android Eclipse IDE Java Java ME
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So far as I know, Linear Search is the algorithm where start searching the array from 0th index till you find a match sequentially.  In this case the array need not be sorted.

For an example

 
Junilu Lacar
Sheriff
Posts: 11494
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I'll bite.

Put all the things you're searching through in a line, one item after another. Starting on one end, check each item to see if it's the one you want. if not, move on to the next one until you've found it or reached the other end of the line.

Simple enough?
 
Lindsey Brooks
Ranch Hand
Posts: 58
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!