Suggestions
Use up and down arrows to review and enter to select.Please wait while we process your payment
If you don't see it, please check your spam folder. Sometimes it can end up there.
If you don't see it, please check your spam folder. Sometimes it can end up there.
Please wait while we process your payment
By signing up you agree to our terms and privacy policy.
Don’t have an account? Subscribe now
Create Your Account
Sign up for your FREE 7-day trial
Already have an account? Log in
Your Email
Choose Your Plan
Save over 50% with a SparkNotes PLUS Annual Plan!
Purchasing SparkNotes PLUS for a group?
Get Annual Plans at a discount when you buy 2 or more!
Price
$24.99 $18.74 /subscription + tax
Subtotal $37.48 + tax
Save 25% on 2-49 accounts
Save 30% on 50-99 accounts
Want 100 or more? Contact us for a customized plan.
Your Plan
Payment Details
Payment Summary
SparkNotes Plus
You'll be billed after your free trial ends.
7-Day Free Trial
Not Applicable
Renews June 8, 2023 June 1, 2023
Discounts (applied to next billing)
DUE NOW
US $0.00
SNPLUSROCKS20 | 20% Discount
This is not a valid promo code.
Discount Code (one code per order)
SparkNotes Plus subscription is $4.99/month or $24.99/year as selected above. The free trial period is the first 7 days of your subscription. TO CANCEL YOUR SUBSCRIPTION AND AVOID BEING CHARGED, YOU MUST CANCEL BEFORE THE END OF THE FREE TRIAL PERIOD. You may cancel your subscription on your Subscription and Billing page or contact Customer Support at custserv@bn.com. Your subscription will continue automatically once the free trial period is over. Free trial is available to new customers only.
Choose Your Plan
For the next 7 days, you'll have access to awesome PLUS stuff like AP English test prep, No Fear Shakespeare translations and audio, a note-taking tool, personalized dashboard, & much more!
You’ve successfully purchased a group discount. Your group members can use the joining link below to redeem their group membership. You'll also receive an email with the link.
Members will be prompted to log in or create an account to redeem their group membership.
Thanks for creating a SparkNotes account! Continue to start your free trial.
Please wait while we process your payment
Your PLUS subscription has expired
Please wait while we process your payment
Please wait while we process your payment
Problem : What is the base case for quicksort? How would combining quicksort with another sorting algorithm like selection sort change the base case?
The base case for quick sort is when the size of the partition we're working on is one element. As it is in order by definition, there is nothing more to do and the recursion can stop. If we were to combine quicksort with another sort like selection sort, the base case for quicksort becomes the size of the partition at which we switch sorts; this is often around five or six elements.Problem : How does mergesort achieve its O(nlogn) efficiency?
Mergesort continually splits the data set in half, and at each step it works on O(n) elements. Since the data set can be split in half O(logn) times, the total work for mergesort is O(nlogn).Problem : While mergesort and quicksort are two "smart" and efficient sorts, there are plenty of inefficient sorts out there, none of which you would ever want to use in a program. One such sort is the permutation sort. A permutation of a data set is one configuration, one ordering of the data. If there are n data elements in a data set, then there are n! permatuations (you have n choices for which element goes first, then n - 1 choices for which element goes second, n - 2 choices for which element goes third, etc, so n!). The permutation sort algorithm computes every permutation of the data set, and for each one checks to see if it is in order If it is, the algorithm ends. If not, it continues on to the next permuation. Write permuation sort recursively (the easiest way to do it). Note that a recursive algorithm can still have loops.
Problem : Your friend Jane proposes the following algorithm for a sort:
Problem : Your friend John claims that quicksort has a worst case running time of O(n2). Is he right?
Yes, quicksort does have a worst case running time of O(n2). If the value of the pivot causes the split to create two sets in every recursive step, one with only 1 element and one with the rest of the elements, then there will be O(n) recursive calls, each one doing O(n) work. Thus an O(n2) algorithm. However, with a good implementation of quicksort that uses pivot picking methods such as random selection and tri-median, the chances of this hapenning are minimal. Quicksort is often the best sort to use, and is used in many commercial and academic programs.Please wait while we process your payment