• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/8

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

8 Cards in this Set

  • Front
  • Back
Bubble Sort - Complexity
Worst: O(n²)
Best: O(n)
Bubble Sort implementation
procedure bubbleSort( A : list of sortable items )
n := length(A)-1
for(i=0; i<= n; i++)
for(j=n; j>i; j--)
if A[j-1] > A[j] then
swap (A[j-1], A[j])
end if
end for
end for
end procedure
Merge Sort - Complexity
O(n log n)
Merge Sort description
split the list into two parts
merge sort left
merge sort right
merge left and right
Quick Sort - complexity
Avg: O(n log n)
Wst: O(n²)
Quick Sort - overall
if first < last
splitPoint = split array
quick sort: first -> splitPoint - 1
quick sort: splitPoint + 1 -> last
Quick Sort - split
sp = some split value
while first &lt;= last do
first++ until first > sp
last++ until last &lt; sp
if first &lt; last(
swap first last
first++
last++
)
end while
swap savedFirst, last
Binary Search Tree - node
left
right
data