Algorithms Flashcards

(19 cards)

1
Q

What is an algorithm?

A

A: A step-by-step set of instructions to solve a problem or complete a task.

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

What is computational thinking?

A

A: A problem-solving approach that includes decomposition, abstraction, pattern recognition, and algorithm design.

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

What is decomposition?

A

A: Breaking a complex problem into smaller, more manageable parts.

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

Why is decomposition useful?

A

A: It makes problems easier to understand, solve, debug, and maintain.

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

What is abstraction?

A

A: Removing unnecessary details to focus on what is important.

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

Why is abstraction useful?

A

A: It simplifies problems and helps create general solutions.

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

What is pattern recognition?

A

A: Identifying similarities or trends in data or problems to make solutions easier.

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

What is pseudocode?

A

A: A simplified, readable version of code that outlines an algorithm without exact syntax.

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

What are flowcharts used for?

A

A: To visually represent the steps of an algorithm using symbols like arrows, decisions, and processes.

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

What does a diamond represent in a flowchart?

A

A: A decision (YES/NO or TRUE/FALSE).

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

What does a rectangle represent in a flowchart?

A

A: A process or instruction.

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

What does an oval represent in a flowchart?

A

A: Start or end of the algorithm.

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

What is a linear search?

A

A: Checking each item in a list one-by-one until the target is found.

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

What is a binary search?

A

A: Repeatedly splitting a sorted list in half to find the target value.

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

Why is binary search more efficient than linear search?

A

A: It eliminates half the remaining data with each step (logarithmic time).

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

What is bubble sort?

A

A: A sorting algorithm that repeatedly swaps adjacent items if they are in the wrong order.

17
Q

What is merge sort?

A

A: A divide-and-conquer algorithm that splits a list into halves, sorts them, then merges them.

18
Q

Compare bubble sort and merge sort.

A

A: Bubble sort is simple but slow; merge sort is fast but uses more memory.

19
Q

What is a trace table?

A

A: A table used to track variable values during each step of an algorithm.