Big O notation

Big O indicates how the number of operations in an algorithm grows as the input grows.

It ignores practical aspects such as cpu speed etc.

Linear (sequential) search

search a data structure

Linear Search O(n)

Linear Search is a classic strategy for searching a data structure eg an array for a specific value.

We migh want to:

  • determine if the value exists
  • edit the value
  • remove the value
  • grab the index of the value

Linear Search can help us achieve these things.

Watch this short video for an intro to Linear Search. It will also introduce the notation for Linear Search.

You will need these code files for the Worksheet Activities.

Task

Copy the Worksheet and save it in your Theme B2 folder.

Open the worksheet and complete the tasks.

Tags

data type INTEGER pseudocode ← array assign STRING index linear search BOOLEAN variable


Feelings

How do you feel right now?