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
Let's wrap up the course by looking at the Big O runtimes for Linear Search and Binary Search.
Quicksort Run Time (Worst Case)
O(n²)
Quicksort Run Time (Average Case)
O(n log n)
Merge Sort Run Time
O(n log n)
Linear Search Run Time
O(n)
Binary Search Run Time
O(log n)
Learning More
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
algorithms were.
0:00
For linear search, you need to do one
comparison to the target value for
0:01
each item in the list.
0:04
Again, theoretically,
0:06
we could find the target value
before searching the whole list.
0:07
But Big O notation is only
concerned with the worst case,
0:10
where we have to search the entire list.
0:13
So for a list of eight items,
that means eight operations.
0:15
The Big O run time for
linear search is O(n),
0:20
where n is the number of items
we're searching through.
0:23
This is also known as linear time.
0:26
Because when the number of items and
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