Paper 2

Cards (188)

  • What are the two frequently needed algorithms in program design mentioned in the study material?
    Searching and sorting algorithms
  • Why have standard algorithms evolved according to the study material?
    To account for the frequent need in program design
  • What is an algorithm in computing?
    • A sequence of logical instructions
    • Used for carrying out a task
    • Essential for designing computer programs
  • What is the purpose of search algorithms as described in the study material?
    To examine a set of data and find a specific item
  • What do sorting algorithms do according to the study material?
    They allow a data set to be sorted into order
  • What are the methods of searching mentioned in the study material?
    • Linear search
    • Binary search
  • What are the methods of sorting mentioned in the study material?
    • Bubble sort
    • Merge sort
    • Insertion sort
  • What is the role of a linear search algorithm?
    To examine each item in a data set sequentially
  • How does a binary search algorithm function?
    It divides the data set in half to find a specific item
  • What is the purpose of a bubble sort algorithm?
    To repeatedly step through the list, swapping adjacent elements if they are in the wrong order
  • What does a merge sort algorithm do?
    It divides the data set into smaller subsets, sorts them, and then merges them back together
  • What is the function of an insertion sort algorithm?
    To build a sorted array one element at a time by comparing and inserting elements
  • What is the significance of standard algorithms in computing?
    • They provide efficient solutions for common tasks
    • They are widely adopted in various programs
    • They help streamline program design and development
  • What are the two frequently needed algorithms in program design mentioned in the study material?
    Sorting and searching algorithms
  • What is a binary search?
    • An efficient method of searching an ordered list
    • Works by dividing the list in half
    • Continues until a match is found or no items remain
  • How does a binary search begin its process?
    By setting the counter to the middle position in the list
  • What are the two frequently needed algorithms in program design mentioned in the study material?
    Sorting and searching algorithms
  • What is a linear search?
    A linear search examines each item in a data set until a match is found
  • What happens if the value at the midpoint of a binary search is less than the value to be found?
    The lower half of the list is ignored
  • How does a linear search begin its process?
    It starts at the beginning of the data set
  • What occurs if the value at the midpoint is greater than the value to be found in a binary search?
    The upper half of the list is ignored
  • What happens if the item being searched for is not found in a linear search?
    The search continues until all items have been examined
  • What are the steps involved in performing a linear search?
    1. Find the length of the data set
    2. Set counter to 0
    3. Examine the value at the counter position
    4. Check if it matches the searched value
    5. If matched, end the search; if not, increment the counter and repeat
    6. If no match is found after all items, indicate that the item is not found
  • In the example provided, what value was being searched for in the unordered list?
    2
  • What does the pseudocode for a linear search indicate about the variable 'found'?
    'found' is initially set to False
  • What would happen if the item searched for in a linear search is the last item in a data set of 100 items?
    All previous 99 items would need to be searched first
  • How does the midpoint get recalculated in a binary search?
    By adding the lowest position to the highest position and dividing by 2
  • What should be done if the midpoint calculation results in a decimal?
    Round up
  • What is a key advantage of linear searches mentioned in the study material?
    They work on any data set, whether ordered or unordered
  • In the example provided, what is the new lowest position after checking position 4 with value 7 when searching for 11?
    5
  • What are the strengths and weaknesses of linear search algorithms?
    Strengths:
    • Simple to implement
    • Works on any data set

    Weaknesses:
    • Can be inefficient for large data sets
    • Requires checking each item sequentially
  • What is the purpose of the 'print' statement in the pseudocode for a linear search?
    To indicate the position where the item was found
  • What are the two frequently needed algorithms in program design mentioned in the study material?
    Sorting and searching algorithms
  • What are the standard sorting algorithms mentioned in the study material?
    • Bubble sort
    • Merge sort
    • Insertion sort
  • What does the 'while' loop in the pseudocode for a linear search check for?
    It checks if 'found' is False and if the counter is less than the length
  • What is the new highest position after checking position 7 with value 14 when searching for 11?
    6
  • What is the simplest of the sorting algorithms?
    Bubble sort
  • What is the final position checked in the binary search example when searching for the value 11?
    6
  • How does the linear search algorithm handle unordered data sets?
    It examines each item sequentially regardless of order
  • How does a bubble sort begin its process?
    It starts at the beginning of the list.