Most data stored by organisations will be in a database format. Some Databases have millions of records.
Interactive systems, such as google or cash machines, rely on data being retrieved from these systems quickly, therefore efficient searching techniques are needs to process all the data quickly and efficiently.
Linear Search
¢Start at the
beginning of the list.
¢Compare each item in
the list with the search item.
¢Stop when the item is
found or when the end of the list is reached.
Advantages.....
¢This technique is
very simple to code.
¢A Linear Search works
with an unsorted list.
Disadvantage.....
¢Linear Searches are
slow, especially with large lists.
Binary Search
1.Find
the Middle Item of the Current Search List.
2.Check
if the Current Item is the Search Item.
3.If
not then make the Current Search List either the Higher Half or the Lower Half
of the list.
4.Go
to Step 1
Advantage.....
¢Much Faster than a Linear Search, especially as the List increases in size.
Disadvantages.....
¢A Binary Search is more Complex to Code.
No comments:
Post a Comment