Searching algorithms - how linear and binary searches work.

preview_player
Показать описание
#searchingalgorithms #binarysearch #linearsearch

This video shows how a linear and binary search works.

A linear search simply looks through each item until it finds the target. a binary search will start at the middle of the list and discount the items that are higher or lower, repeating this until it finds it's target.

You should understand the positives and negatives of both:

Linear search
+ Works!
+ Doesn’t need to be in order
- Slow and inefficient for larger lists

Binary search
+ Fast!
+ More efficient with large amounts of numbers
- Numbers have to be in order
- Must be an odd amount of numbers in the list for it to work

See also:

Thank you for watching, please like and subscribe, it really helps!
Рекомендации по теме
visit shbcf.ru