Algorithms And Flow Charts Flashcards

1
Q

What is an algorithm?

A

A clear, step-by-step set of instructions used 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 a flowchart?

A

A visual representation of an algorithm using standard symbols to show the flow of control and logic.

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

What are the key symbols used in flowcharts?

A

• Terminator (Oval): Start/End
• Process (Rectangle): Task or instruction
• Decision (Diamond): Yes/No or True/False question
• Input/Output (Parallelogram): Data going in or out
• Arrow: Direction of flow

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

What is pseudocode?

A

A way of describing an algorithm using structured but plain English, resembling code but not specific to a language.

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

Why do we use pseudocode and flowcharts?

A

To plan programs clearly, understand logic, and communicate algorithms before actual coding.

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

What is linear search?

A

An algorithm that checks each item in a list one at a time until it finds the target or reaches the end of the list.

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

What is binary search?

A

An efficient algorithm that repeatedly divides a sorted list in half to find a target item.

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

What are the advantages of binary search over linear search?

A

Faster for large, sorted lists — reduces the number of checks needed.

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

What are the requirements for using binary search?

A

The list must be sorted in order.

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

What is a sorting algorithm?

A

An algorithm that arranges data into a specific order (e.g., ascending or descending).

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

What is bubble sort?

A

A sorting algorithm that repeatedly steps through a list, compares adjacent items, and swaps them if needed until the list is sorted.

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

What are the advantages and disadvantages of bubble sort?

A

• Advantages: Simple to understand and implement
• Disadvantages: Very inefficient for large lists

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

What is merge sort?

A

A sorting algorithm that divides the list into smaller parts, sorts them, and then merges them back together in order.

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

Compare bubble sort and merge sort.

A

• Bubble sort: Slower, simpler
• Merge sort: Faster and more efficient for large data sets, but uses more memory due to recursion and merging steps

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

How do you trace an algorithm?

A

By simulating it step by step, keeping track of variable values to understand what it does or find errors.

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

What is abstraction in algorithms?

A

Removing unnecessary details to focus on the main idea or logic of the problem.