2.1 - Searching and Sorting Algorithms

In my first year of university there was a girl called Melanie who lived a few floors below me in our tower block. She had the distinction of owning quite the most disgustingly untidy room I have ever seen and indeed it had to be seen to be believed. I made the mistake of trying to walk in there once and managed to get the door open just enough to poke my head round it. I took one look at Stig of the Dump's Lair before sensibly retreating to a safe distance before a life form emerged and took me hostage.
There wasn't a square inch of carpet visible, there was stuff just strewn all over the place. I did contemplate trying to see how many obscure items I could hide amongst the debris before she noticed - bits of taxidermy, road signs, a traffic warden, those kinds of things.
Why am I telling you this story? Well, it turned out that Melanie had quite the most amazing ability to find absolutely anything in there. Ask her to borrow a course text book, in she'd go and return seconds later with it. Need a pneumatic drill? In she'd go, out she'd come with it moments later. There wasn't any rummaging - to her that pile of trash was a highly organised, systematic mess. I did wonder if her mind was organised in the same way. She clearly had an algorithm, a method of finding things that was highly effective. Indeed, the only person I've seen since with such brilliant powers of recall is Derren Brown and he makes a lot of cash using some very clever algorithms.
See, algorithms - fun and useful in real life.
You need to know how to sort information in to order using:
And then you need to be able to find it using:
Use the videos below to help you revise/learn these algorithms.
There wasn't a square inch of carpet visible, there was stuff just strewn all over the place. I did contemplate trying to see how many obscure items I could hide amongst the debris before she noticed - bits of taxidermy, road signs, a traffic warden, those kinds of things.
Why am I telling you this story? Well, it turned out that Melanie had quite the most amazing ability to find absolutely anything in there. Ask her to borrow a course text book, in she'd go and return seconds later with it. Need a pneumatic drill? In she'd go, out she'd come with it moments later. There wasn't any rummaging - to her that pile of trash was a highly organised, systematic mess. I did wonder if her mind was organised in the same way. She clearly had an algorithm, a method of finding things that was highly effective. Indeed, the only person I've seen since with such brilliant powers of recall is Derren Brown and he makes a lot of cash using some very clever algorithms.
See, algorithms - fun and useful in real life.
You need to know how to sort information in to order using:
- Bubble sort
- Merge sort
- Insertion sort
And then you need to be able to find it using:
- Linear search
- Binary search
Use the videos below to help you revise/learn these algorithms.
Bubble Sort |
Merge Sort |
Insertion Sort
|
|
Binary Search |
Linear Search |