Cards (47)

  • What are the two frequently needed algorithms in program design?
    Searching and sorting algorithms
  • Why have common algorithms evolved in computing?
    To meet the needs of program design
  • What is an algorithm in computing?
    • A sequence of logical instructions
    • Used for carrying out tasks
    • Essential for designing computer programs
  • What is the purpose of search algorithms?
    To find specific items in data sets
  • What is the purpose of sort algorithms?
    To put items in a data set into order
  • What are the methods of searching in algorithms?
    • Linear search
    • Binary search
  • What are the methods of sorting in algorithms?
    • Bubble sort
    • Merge sort
  • How do searching algorithms differ from sorting algorithms?
    Searching finds items; sorting orders items
  • What is a data set in computing?
    A collection of units of information
  • What types of data can be included in a data set?
    Integers, characters, and Boolean
  • What is the role of instructions in computing?
    To act on data in a data set
  • What is the significance of algorithms in program design?
    They provide structured instructions for tasks
  • How have algorithms been adopted in many programs?
    By evolving to meet common user needs
  • What are two frequently needed algorithms in program design?
    Searching and sorting algorithms
  • What is a linear search algorithm used for?
    To find a value in a list of data
  • What does the term 'data' refer to in computing?
    Units of information
  • What is the first step in a linear search algorithm?
    Identify a search term
  • What happens if the current item matches the search term in a linear search?
    The item has been found
  • What does the linear search algorithm do if the search term is not found?
    Stops and indicates the term is not in the list
  • How does a linear search algorithm operate on a list?
    • Identify a search term
    • Check each item in the list sequentially
    • If found, return the position
    • If not found, indicate absence
  • Why does the linear search algorithm become inefficient for large lists?
    It takes longer to check each item
  • What is pseudo-code?
    A method of writing instructions in plain English
  • What does the pseudo-code for a linear search include?
    Variables for found status and counter
  • How does the pseudo-code indicate when an item is found?

    By setting 'found' to True
  • What does the output 'Item not found' signify in the pseudo-code?
    The search term was not in the list
  • What are the key components of a linear search algorithm?
    • Identify search term
    • Sequentially check each item
    • Update found status
    • Output position or absence
  • What are two frequently needed algorithms in program design?
    Sorting and searching algorithms
  • What is the purpose of algorithms in computing?
    To design computer programs
  • What is binary search?
    A complex algorithm for searching
  • What does a linear search algorithm do?
    Searches for an item in an array
  • What is required for a binary search to work?
    All items must be in order
  • What happens with each loop in a binary search?
    Half of the data is removed
  • What is an index in a list?
    The position of a piece of data
  • How is the midpoint identified in a binary search?
    Add lowest and highest index, divide by two
  • What is an integer?
    A whole number used in programming
  • Why does it not matter whether we round up or down in binary search?
    As long as the same method is applied
  • How do you find the midpoint if the highest index is 8 and the lowest is 0?
    Midpoint is 4
  • What are the steps of the binary search algorithm?
    1. Set counter to middle position
    2. Check if value matches
    3. If less, ignore lower half
    4. If greater, ignore upper half
    5. Repeat until match or no items left
  • What is a trace table used for?
    To record changes in variable values
  • What does the pseudo-code for binary search include?
    Instructions for finding an item