Save
Upgrade to remove ads
Busy. Please wait.
Log in with Clever
or

show password
Forgot Password?

Don't have an account?  Sign up 
Sign up using Clever
or

Username is available taken
show password


Make sure to remember your password. If you forget it there is no way for StudyStack to send you a reset link. You would need to create a new account.
Your email address is only used to allow you to reset your password. See our Privacy Policy and Terms of Service.


Already a StudyStack user? Log In

Reset Password
Enter the associated with your account, and we'll email you a link to reset your password.
focusNode
Didn't know it?
click below
 
Knew it?
click below
Don't Know
Remaining cards (0)
Know
0:00
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.

  Normal Size     Small Size show me how

132 Sort

Sorting algorithms for cmsc132 final exam

TermDefinition
Bubble Sort Worst Case O(n^2)
Bubble Sort Best Case O(n)
Is Bubble Sort In-Place? Stable? Yes in place Yes stable
Bubble Sort Average Case O(n^2)
Explain how Bubble Sort works. Is it D&C or Comparison based? checks the element nearest to it and swaps them if the one next to it is smaller. This makes it so the largest elements bubble up into their correct place Comparison based
Selection Sort worst case O(n^2)
Selection Sort best case O(n^2)
Selection sort average case O(n^2)
Explain how Selections sort works. Is it D&C or comparison based? Selection sort takes the element at the current index, finds the smallest element in the array in the current index and up, and swaps it with the current value. Comparison based.
Is selection sort in place? stable? Yes in place Not stable
Insertion Sort worse case O(n^2)
Insertion Sort best case O(n)
Insertion sort average case O(n^2)
Explain how insertion sort works. Is it D&C or comparison based? Insertion sort keeps a pointer of the array that is sorted. Takes a new item and inserts it into the already sorted section of the array. Comparison
Is insertion sort in place? stable Yes in place Yes stable
Quick sort worst case O(n^2)
Quick sort best case O(n log n)
Quick sort average case O(n log n)
How does quick sort work? Is it D&C or comparison based. (easy split vs. easy merge) Quick sort breaks the array into two sections (elements less than the pivot and elements greater than the pivot) and it basically keeps doing this until it has sorted sections of length 1, then it merges them all back together hard split, easy merge
Is quick sort in place? stable? In place Not stable
Merge sort worst case O(n log n)
Merge sort best case O(n log n)
Merge sort average case O(n log n)
How does merge sort work? Is it D&C or comparison based. (easy split vs. easy merge) Divides the array in half, sorts each half, merges the halves back together at the end. Divide and conquer. Easy split, hard merge
Is merge sort in place? stable? Usually out of place yes stable
Heap sort worst case O(n log n)
Heap sort best case O(n log n)
Heap sort average case O(n log n)
How does heap sort work? is it D&C or comparison? comparison based. Build a max heap from the given array. repeatedly remove the max element and place at the end of the array (then heapify)
Is heap sort in place? stable? In place Not stable
Created by: Lily_loves_u
 

 



Voices

Use these flashcards to help memorize information. Look at the large card and try to recall what is on the other side. Then click the card to flip it. If you knew the answer, click the green Know box. Otherwise, click the red Don't know box.

When you've placed seven or more cards in the Don't know box, click "retry" to try those cards again.

If you've accidentally put the card in the wrong box, just click on the card to take it out of the box.

You can also use your keyboard to move the cards as follows:

If you are logged in to your account, this website will remember which cards you know and don't know so that they are in the same box the next time you log in.

When you need a break, try one of the other activities listed below the flashcards like Matching, Snowman, or Hungry Bug. Although it may feel like you're playing a game, your brain is still making more connections with the information to help you out.

To see how well you know the information, try the Quiz or Test activity.

Pass complete!
"Know" box contains:
Time elapsed:
Retries:
restart all cards