2.1 Flashcards

(38 cards)

1
Q

What is abstraction?

A

Removing unnecessary details to focus on what’s important in solving a problem.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is decomposition?

A

Breaking a problem into smaller more manageable sub-problems, each achieving a specific task.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is algorithmic thinking?

A

The ability to create a set of instructions to find the solution to a problem.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is pattern recognition?

A

The process of identifying similarities or recurring features in problems and solutions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is an algorithm?

A

A sequence of steps that can be followed to complete a task.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are three common ways to represent algorithms?

A

Pseudocode, program code (e.g. Python), and flowcharts.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a flowchart?

A

A diagram which uses symbols to represent the steps and decision-making processes of an algorithm.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What should you always do in an exam question about algorithms?

A

Use the required format (e.g. code to be written in pseudocode or program code, flowcharts if asked).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the three stages of an algorithm?

A

Inputs, processing, and outputs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How can you determine the purpose of a simple algorithm?

A

By using trace tables or visually inspecting the algorithm.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a trace table?

A

A tool to track the values of variables step by step as an algorithm runs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a syntax error?

A

An error which breaks the rules of the programming language, meaning the program will not run, e.g. missing colon in Python.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a logic error?

A

An error which causes a program to produce the wrong result; a program with a logic error will still run as long as it has correct syntax.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the purpose of a searching algorithm?

A

To find a specific value (target) in a list of data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the two searching algorithms?

A

Linear search and binary search.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How does a linear search work?

A

It checks each item in the list one by one until the target is found or the end is reached.

17
Q

What type of data can linear search be used on?

A

Any list-sorted or unsorted.

18
Q

What are two advantages of linear search?

A

Simple to write and works on unsorted data.

19
Q

What is a major disadvantage of linear search?

A

It is slow on large data sets.

20
Q

How does binary search work?

A

It repeatedly divides a sorted list in half and compares the middle item to the target.

21
Q

What is the main requirement for using binary search?

A

The list must be sorted in order.

22
Q

Why is binary search more efficient than linear search?

A

It halves the number of items that need to be checked with each step, so it is faster for large data sets.

23
Q

What are the downsides of binary search?

A

More complex to code and only works on sorted data.

24
Q

What is meant by “divide and conquer” in binary search?

A

“Divide and conquer” refers to how the algorithm splits the list in half each time when trying to find the target.

25
Which search algorithm is better for small or unsorted data sets?
Linear search.
26
Which search algorithm is better for large, sorted data sets?
Binary search.
27
What is a sorting algorithm?
An algorithm used to arrange data (e.g. numbers or text) into a specific order, usually ascending or descending.
28
What are the three sorting algorithms?
Bubble sort, merge sort and insertion sort.
29
How does bubble sort work?
It repeatedly compares and swaps adjacent items, if they are in the wrong order, until the list is sorted.
30
What happens during each pass of a bubble sort?
Adjacent elements are compared and swapped if needed; multiple passes are made until no swaps are needed.
31
Is bubble sort efficient for large datasets?
No, it's very slow on large or reversed lists.
32
What are the advantages of bubble sort?
It is easy to understand and simple to implement.
33
What's a disadvantage of bubble sort?
It is inefficient and has poor performance with large or nearly sorted lists.
34
How does merge sort work?
It splits the list into halves (recursively), then merges the halves back together in order.
35
What type of approach does merge sort use?
A divide and conquer strategy.
36
What is a disadvantage of merge sort?
It uses more memory because of recursion and multiple temporary lists.
37
How does insertion sort work?
It looks at each item in the list (in order) and inserts it into the correct position on its left.
38
What is an advantage of insertion sort?
It is very simple to understand.