Search methods

Linear and binary search

Card 1

The beginning

Linear and binary search are two methods used to find an element in a list. The linear search checks each element one by one, while the binary search splits the sorted list to quickly find the desired value.

Try for vector =  

  and deCăutat =  

THE VECTOR MUST BE SORTED!

Linear search

This card shows linear search in the C++ language.

Animation

The linear search animation appears in this card.

Binary search

This card shows binary search in the C++ language.

Animation

This card shows the animation of binary search, using a sorted vector for visual demonstration.