Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Algorithms: Sorting and Searching!
You have completed Algorithms: Sorting and Searching!
Preview
To help make clear the importance of choosing a good sorting algorithm, we're going to start with a bad one. It's called "Bogosort".
See the instruction step that follows this video; we'll have details on the code there!
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
So we're going to start by
sorting a list of numbers.
0:00
I'll show you how to modify our examples
to sort strings at the end of the course.
0:00
To help make clear the importance of
choosing a good sorting algorithm,
0:04
we're going to start with a bad one.
0:08
It's called bogo_sort.
0:10
Basically, bogo_sort just randomizes
the order of the list repeatedly
0:12
until it's sorted.
0:17
Here's a Python code file where
we're going to implement bogo_sort.
0:18
It's not important to understand
this code here at the top.
0:22
Although, we'll have info on it in the
teacher's notes, if you really want it.
0:25
All you need to know is that it takes the
name of a file that we pass on the command
0:28
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up