Algorithms

Cards (55)

  • Computation Thinking
    • Decomposition: breaking a complex problem down into smaller problems and solving each one individually.
    • Algorithmic Thinking: A logical way from the problem to the solution. If the steps you take to solve a problem follow an algorithm, they can be used for similar problems in the future.
    • Abstraction: Picking out important bits from the information, ignoring what doesn't matter.
  • Algorithmic Thinking: A logical way from the problem to the solution. If the steps you take to solve a problem follow an algorithm, they can be used for similar problems in the future.
  • Abstraction: Picking out important bits from the information, ignoring what doesn't matter.
    • Decomposition: breaking a complex problem down into smaller problems and solving each one individually.
  • Pseudocode
    • Not an actual programming language, follows a similar structure.
    • Shows algorithm ignoring syntax so it can be used in any programming language.
    • Quick to write.
    • Easily converted.
  • Terminals
    The beginning and the end of the algorithm.
  • Parallelogram Box
    Anything that's taken into and out of the algorithm.
  • Rectangular Box

    General processes, instructions, and calculations.
  • Diamond Boxes
    Often 'yes' or 'no' questions.
  • Arrows
    Connect boxes and show the direction that should be followed.
  • What is computational thinking?
    It is the steps taken to find the best solution to a complex problem.
  • What is decomposition in computational thinking?
    Breaking a complex problem down into smaller problems.
  • What does abstraction involve in computational thinking?
    Picking out important information while ignoring irrelevant details.
  • What is algorithmic thinking?
    A logical way of getting from the problem to the solution.
  • How can computational thinking be applied in real life?
    By breaking down decisions into manageable tasks.
  • What is the first step in algorithmic thinking when deciding which film to watch?
    Listing all the films that are showing.
  • How does decomposition help in sorting product names alphabetically?
    It helps define what alphabetical order means and how to compare entries.
  • What is the purpose of pseudocode in writing algorithms?
    Pseudocode shows an algorithm's steps without worrying about syntax.
  • What is an example of a simple pseudocode algorithm?
    Take worker’s current salary, multiply by 1.1, display the answer.
  • Why should pseudocode not be too vague?
    It needs to be readable and easy to interpret.
  • What do flow diagrams use to represent different commands?
    Different shapes for different commands.
  • What does a diamond box represent in a flow diagram?
    A decision point, often a yes or no question.
  • What is the purpose of arrows in flow diagrams?
    To show the direction of the flow of the algorithm.
  • What is a binary search algorithm used for?
    To find items in an ordered list.
  • What is the first step in a binary search algorithm?
    Find the middle item in the ordered list.
  • What happens if the middle item in a binary search is not the target item?
    You compare the target item to the middle item and eliminate half the list.
  • How does a linear search operate?
    It checks each item in the list one by one.
  • What is the main difference between binary search and linear search?
    Binary search is for ordered lists, while linear search can be used on unordered lists.
  • What is the first step in the binary search algorithm?
    Compare the item you're looking for to the middle item.
  • What happens if the item you're looking for comes before the middle item in a binary search?
    You get rid of the second half of the list.
  • How do you reduce the size of the list in a binary search?
    By eliminating half of the list based on the comparison with the middle item.
  • How does the binary search algorithm improve efficiency compared to a linear search?
    It reduces the list size by half with each comparison.
  • What is the main characteristic of a linear search?
    It checks each item in the list in turn.
  • When does a linear search stop?
    When it finds the item or has checked every item.
  • Why is a linear search often only used on small lists?
    Because it is inefficient for larger lists.
  • What is the worst-case scenario for a linear search?
    Checking every item in the list without finding the target.
  • What is the first step in the bubble sort algorithm?
    Look at the first two items in the list.
  • What do you do if the first two items in a bubble sort are in the wrong order?
    Swap them.
  • How do you know when to stop making passes in a bubble sort?
    When there are no swaps in a pass.
  • What is a key advantage of the bubble sort algorithm?
    It can efficiently check if a list is already in order.