Sorting algorithms

0.0(0)
studied byStudied by 2 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/3

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

4 Terms

1
New cards

Bubble sort

  • Compares pairs of items

  • First 2 items in a list are compared

  • If item1 > item2 then swap

  • Else do nothing repeat with next 2 items

2
New cards

Quick Sort

  • Choose an item to be the pivot (usually last or first)

  • Move all items that are smaller than the pivot to the left and those larger to the right

  • Repeat as other items as pivots

3
New cards

Linear Search

  • Involves checking each item in a list of data on at a time to see if it’s the right item.

  • If the list isn’t in order, linear search is the way.

4
New cards

Binary Search

  • Dividing the list into half each time

  • If midpoint is less than desired item then focus on items after the midpoint

  • If midpoint is more than desired item then focus on items before the midpoint.

  • If there is an even number of items select the middle left item

  • Keep repeating until you find the answer

  • Can only be used when list is in order