2.1 - Algorithms Flashcards
(20 cards)
What is abstraction in computational thinking?
Abstraction involves removing unnecessary details to focus on the essential aspects of a problem.
Provide an example of abstraction in computing.
Using symbols on a map to represent real-world objects like roads and buildings.
What is decomposition in computational thinking?
Decomposition is breaking down a complex problem into smaller, more manageable parts.
Why is decomposition useful in problem-solving?
It simplifies complex problems, making them easier to understand and solve.
What is algorithmic thinking?
Algorithmic thinking is the ability to develop a step-by-step solution to a problem or to identify the steps needed to solve it.
What are the three main principles of computational thinking?
Abstraction, Decomposition, and Algorithmic Thinking.
What is a structure diagram?
A visual representation that shows the breakdown of a system into its component parts.
What is pseudocode?
A method of writing algorithms using plain language that resembles programming code.
What is a flowchart?
A diagram that represents a process or algorithm, showing the steps as boxes connected by arrows.
What is the purpose of a trace table?
To track the values of variables during each step of an algorithm to identify errors.
What is a linear search?
A search algorithm that checks each element in a list sequentially until the desired element is found or the list ends.
What is a binary search?
A search algorithm that repeatedly divides a sorted list in half to locate a target value.
What is a bubble sort?
A sorting algorithm that repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order.
What is an insertion sort?
A sorting algorithm that builds the final sorted list one item at a time by comparing and inserting elements into their correct position.
What is a merge sort?
A divide-and-conquer sorting algorithm that divides the list into halves, sorts them, and then merges the sorted halves.
What are the advantages of using a binary search over a linear search?
Binary search is more efficient for large, sorted lists, reducing the time complexity to O(log n) compared to O(n) for linear search.
What is the time complexity of bubble sort in the worst case?
O(n^2), where n is the number of elements to sort.
What is the key difference between merge sort and bubble sort?
Merge sort is more efficient with a time complexity of O(n log n) and uses a divide-and-conquer approach, while bubble sort is simpler but less efficient.
What is the purpose of using pseudocode and flowcharts in algorithm design?
They help in planning and visualizing the algorithm before implementation, making it easier to understand and debug.
What is the significance of identifying inputs, processes, and outputs in algorithm design?
It helps in clearly defining what the algorithm will receive, what it will do, and what it will produce, ensuring a complete understanding of the problem.