Understanding the following standard searching algorithms

Cards (20)

  • What is the approach of Linear Search?
    Checks each element sequentially
  • What is the efficiency of Binary Search?
    O(log n)
  • Linear Search begins at the first element of the list.

    True
  • If the target value is not found in Binary Search, it returns -1
  • Linear Search requires the list to be sorted.
    False
  • Searching algorithms are methods used to locate a specific element
  • The efficiency of Linear Search is O(n)
  • Steps of Binary Search
    1️⃣ Start in the middle
    2️⃣ Compare middle element to target
    3️⃣ Narrow search to left or right half
    4️⃣ Repeat until target is found or interval is empty
  • If the middle element in Binary Search is equal to the target value, the search ends.

    True
  • Linear Search checks each element sequentially
  • Steps of Linear Search
    1️⃣ Start at the first element of the list
    2️⃣ Compare the current element with the target item
    3️⃣ If they match, return the index
    4️⃣ If they don't match, move to the next element
    5️⃣ Repeat steps 2-4 until the target item is found or the end of the list is reached
    6️⃣ If the target item is not found, return -1
  • Match the feature with the correct algorithm:
    Requires Sorted List ↔️ Binary Search
    Efficiency of O(n) ↔️ Linear Search
  • Binary Search requires the list to be sorted.

    True
  • Steps of Linear Search
    1️⃣ Start at the first element
    2️⃣ Compare each element to the target
    3️⃣ If they match, return the index
    4️⃣ Repeat until target is found or end is reached
  • What type of list does Binary Search require?
    Sorted
  • Linear Search compares each element until the target is found or the end of the list is reached.

    True
  • Linear Search is a straightforward algorithm used to find a specific item within a list or array
  • Binary Search has an efficiency of O(log n).

    True
  • Binary Search is a highly efficient algorithm used to find a specific element within a sorted list or array.
  • Binary Search divides the search interval in half