Cards (8)

  • What is the main task of a sorting algorithm?
    To put elements of an array in order
  • What is the benefit of using sorted lists in searching?
    It reduces the time to locate an item
  • Name 2 types of Sorting Algorithms?
    Bubble sort and merge sort
  • What is the time complexity of the bubble sort algorithm?
    O(n²)
  • How does a computer determine if the list is sorted in bubble sort?
    By making a pass with no swaps
  • What are the steps of the bubble sort process?
    1. Compare adjacent elements
    2. Swap if out of order
    3. Repeat until sorted
    4. Confirm sorted with no swaps
  • What is the time complexity of merge sort?
    O(n log n)
  • What is the process of merge sort?
    1. Split the list into smaller lists
    2. Continue splitting until single elements
    3. Merge lists by comparison
    4. Form a new sorted list