bubble sort

Cards (26)

  • BUBBLE SORT: A sorting technique that involves placing items in a list then ordering in order of alpherbet/number
    • Check if number in position 0 is greater than the number in position 1.
    • Check if the number in position 1 is greater than the number in position 2.
    • Continue checking whether each position is greater than the number in the position next to it until the you reach the end.
    • The number in the last position of the list has now been sorted.
    • Pass through the list as many times as required. This should be 1 less than the number of values in the list.
  • What sorting algorithm is being discussed?
    Bubble sort
  • What is the main action performed in bubble sort?
    Comparing and swapping adjacent items
  • What happens to the highest number during bubble sort?
    It bubbles to the right
  • What forms at the end of the array during bubble sort?
    A sorted partition
  • What is the result after completing the bubble sort algorithm?
    The array is sorted
  • What is the pseudocode structure for bubble sort?
    • Nested for-loop
    • Compare adjacent items
    • Swap if out of order
    • Repeat until sorted
  • What is the worst-case time complexity of bubble sort?
    Big O of n2n^2
  • What does nn represent in the time complexity of bubble sort?

    The size of the array
  • What should students do if they have questions about bubble sort?
    Ask them below the video
  • What is the first step in the bubble sort process?
    Compare adjacent items
  • What does the term "iteration" refer to in bubble sort?
    A complete pass through the array
  • How does bubble sort ensure that the highest number is in the correct position?
    By repeatedly swapping adjacent out-of-order items
  • What does the bubble sort algorithm do?
    It compares and swaps items in order
  • When does the bubble sort algorithm swap items?
    When they are in the wrong order
  • How does bubble sort start its process?
    At the beginning of the list
  • What is the process of comparing items in bubble sort?
    • Compare each pair of adjacent items
    • Swap them if they are in the wrong order
    • Repeat until the entire list is sorted
  • How many items does bubble sort compare in each iteration?
    Each pair of adjacent items
  • What happens if items are in the wrong order during bubble sort?
    They are swapped to correct the order
  • What is the stopping condition for bubble sort?
    When no swaps are left to perform
  • What is the final step in the bubble sort process?
    All swaps are completed
  • What does the notation "7.5 = 5.74" imply in the context of bubble sort?
    It indicates a specific comparison or swap
  • What should you do if items are still in the wrong order after a pass in bubble sort?
    Continue repeating the process
  • What is the significance of repeating until no swaps are left?
    It ensures the list is fully sorted
  • What are the key steps in the bubble sort algorithm?
    1. Start at the beginning of the list
    2. Compare each pair of adjacent items
    3. Swap if they are in the wrong order
    4. Repeat until no swaps are needed