5.3 Other types of Searching and Sorting Algorithms


Searching Algorithms

The Binary Search Algorithm


The Binary Search Algorithm cuts an array in half and compares the key to the middle item. Every iteration, it cuts it in half again and compares the key to the new middle item.

Linear Search


Compares one element of the array to every individual element, one at a time. It’s not very efficient, but is simple and gets the job done!

Sorting Algorithms

Bubble Sort


It compares elements to the one right next to them and arranges them accordingly.

Merge Sort


It takes a big array and sorts it into multiple small arrays and then rearranges the big array.


Previous Section

Next Chapter

Copyright © 2021 Code 4 Tomorrow. All rights reserved. The code in this course is licensed under the MIT License. If you would like to use content from any of our courses, you must obtain our explicit written permission and provide credit. Please contact classes@code4tomorrow.org for inquiries.