Showing posts with label Comparison. Show all posts
Showing posts with label Comparison. Show all posts

Saturday, 24 December 2011

Searching - Brief Idea

Searching algorithms have been studied nearly as much as sorting algorithms. The two are related in that many searching algorithms rely on the ordering of the data being searched. There are four basic kinds of searching algorithms:

  • Sequential searching

  • Comparison searching

  • Radix searching

  • Hashing


Each of these methods can be described using the same deck of cards example that was used for sorting.

In sequential searching, you go through the deck from top to bottom, looking at each card until you find the card you are looking for.

In comparison searching (also called binary searching), you start with