Skip main navigation

Comparing linear and binary search

In this step, we’re going to compare linear and binary search, and see how well they perform on a variety of sorted lists when searching for specific items. Just as …

Python: Implementing Binary Search

In this article, you’re going to implement the binary search algorithm. The article will walk you through how to program it in Python, and then ask you to make a …

Binary Search

We’ve seen how linear search can be made a bit more efficient if you know you are searching a sorted list. In this step, we’ll look at a much more …

Algorithm efficiency

In Week 2 we noted that there can be different algorithms for solving the same problem and that some alternative algorithms achieve the same result. One important factor in choosing …

Implementing linear search

In this step you’re going to implement your own basic version of linear search, and then write a more efficient algorithm that is optimised to work on sorted lists. The …

Linear search explained

Linear search is a simple search algorithm to understand and to implement. It just involves checking each item in a list in order (hence “linear”) to see if it’s the …

What is searching, and why do we do it?

Whenever we have lots of items, it’s important to be able to find the one we need. Examples of searching in everyday life include: Looking through a clothing rail to …

Comparing efficiency

Hopefully you saw in the last section that bubble sort is a pretty inefficient algorithm. In almost every case, merge sort will sort a list much quicker than bubble sort. …

An introduction to merge sorts

Now let’s look at another sorting algorithm, one that is a little bit more efficient than bubble sort. The merge sort algorithm uses what’s called a divide and conquer strategy, …

Implementing bubble sort

Now you’re going to write a bubble sort program in Python. You’ll create a basic implementation to start with, and then try to make a few improvements. Let’s begin by …

Examples of bubble sorts from the web

There are pleanty of interactive bubble sort demonstrations available on the web. Before you go ahead and program your own bubble sort algorithm, have a look at one of the …

An introduction to Bubble Sorts

In this step, we’re going to look at a method of sorting lists called bubble sort. The bubble sort algorithm is one of the simplest sorting algorithms to implement. It’s …

What is sorting, and why do we do it?

Humans like to categorise and order things, to greater or lesser degrees. If you walk into a kitchen, the chances are that you will find there is a drawer set …

Implement count function

Having discussed the algorithm for our counting function, let’s try to implement it in another context. Imagine a class has completed a short online quiz to test their knowledge. Marks …
close
  • 30% off Futurelearn Unlimited!