Standard Methods of a Solution Flashcards

(10 cards)

1
Q

What is a searching algorithm?

A

Searching algorithms are precise step-by-step instructions that a computer can follow to efficiently locate specific data in massive datasets.

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

What is a sorting algorithm?

A

Sorting algorithms are precise step-by-step instructions that a computer can follow to efficiently sort data in massive datasets.

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

What is a linear search?

A
  • Checks each item in a dataset one by one
  • Can work on unsorted data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How does a linear search work?

A

1️⃣ Check the first value
2️⃣ If it’s the target value → STOP
3️⃣ Else, move to the next value
4️⃣ Repeat until the value is found or all values are checked

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

What is a bubble - sort?

A
  • A simple sorting algorithm
  • Compares pairs of values and swaps them if out of order
  • One full run through the list = a pass
  • Repeats passes until no swaps are needed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How does a bubble - sort work?

A

1️⃣ Compare the first two values
2️⃣ If in wrong order → swap them
3️⃣ Move to the next pair
4️⃣ Repeat until end of list (1 pass)
5️⃣ If swaps made → start another pass
6️⃣ If no swaps → STOP, list is sorted

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

Totalling Example

A

Total ← 0
FOR Count ← 1 TO ReceiptLength
INPUT ItemValue
Total ← Total + ItemValue
NEXT Count
OUTPUT Total

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

What is totalling?

A

Totalling is keeping a running total of values entered into the algorithm

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

What is counting?

A
  • Counting is when a count is incremented or decremented by a fixed value, usually 1, each time it iterates
  • Counting keeps track of the number of times an action has been performed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Counting Example

A

Count ← 0
DO
OUTPUT “Pass number”, Count
Count ← Count + 1
UNTIL Count >= 50

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