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 Introduction to Data Structures!
You have completed Introduction to Data Structures!
Preview
In this video let's write the first bit of logic in our merge sort algorithm - the dividing into sublists.
This video doesn't have any notes.
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
This step is fairly straight forward and
only requires a few lines of code, but
0:00
is essential to get
the sorting process going.
0:00
All right, so as we saw earlier,
we are going to call the function for
0:02
the divide step split.
0:06
So we'll say def split, and split is going
to take as an argument a list to split up.
0:07
Let's document how this function works.
0:14
So I'll say, divide the unsorted
list at midpoint into sublists.
0:17
And it's always good to say,
what we're returning as well.
0:26
So I'll say returns to sublists,
left and right.
0:29
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