Welcome to the Fourteenth of Altitude Foundation’s #MicroChallenges2020
Today we’re looking at searching and sorting datasets!
What’s a Micro Challenge?
These challenges are short activities to help you develop, revise or refresh your coding skills, posted every Monday, Wednesday and Friday.
Micro Challenge #14
This week, our focus is on searching and sorting. Today’s challenge is all about deciding which search works for which datasets.
In Monday’s challenge, we asked you to try different ways of searching for a random computer selected number. You probably tried at least one of these searches:
Serial search – where you create a programme to search through all the available data until the searched for item is found.
Binary search – where the programme finds the midpoint of your data, then searches half of it; it discards the section of data which doesn’t contain the searched for item, then halves the remaining data and repeats until it identifies the correct item.
if you want a refresher, BBC Bitesize has a useful video overview of the difference between the two searches.
Below are a series of data sets. Which of the two searches listed above would be best for each set and why?
- Ambleside, Blyth, Consett, Durham, Hartlepool, Newcastle, Sunderland
- Shredder, Leonardo, Donatello, April, Splinter, Michaelangelo
- 1, 2, 3, 5, 8, 13, 21, 34,
- Copenhagen (1,5 mil); Delhi (18,9 mil); Lagos (21 mil); London (8,5 mil); New York (8,4 mil); Tokyo (9,25 mil)
- 62, 50, 53, 150, 35, 250, 44
Can you come up with a rule for which search works when?
What other datasets could you look at – what other types of data might be useful to search?
Could you create an algorithm which selects the best form of sorting for any set of data? (Ironically, you will have to pick one form of sorting to do so!)
We would love to see what you have created! Please send any pictures, videos, or files of your activities to us – either via Facebook, Twitter or Instagram using #MicroChallenges2020 or to firstname.lastname@example.org. If you are emailing them to us, please let us know if you are happy for us to share your stuff on our social media platforms (with credit, of course).
Sign-up here to receive a weekly email with Micro Challenges top tips and solutions: