3.1 Algorithms Flashcards

1
Q

What is an algorithm?

A

A set of instructions to complete a task

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

What is decomposition?

A

Breaking down problems into sub problems until each sub problem can be solved separately

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

What is Pseudocode and its benefits?

A

-Pseudocode is a way of writing code in plain English
-Pseudocode can be translated into all other coding languages
-It can be easy to understand

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

What are terminators in a flowchart and what shape is it?

A

-A start or end
-It is oval shaped

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

What is an input/output in flowchart and what shape is it?

A

-Where a flowchart is inputting information or outputting it back to the user
-It is a parallelogram shape
-writeline and readline in VB
-OUTPUT and USERINPUT in Pseudocode

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

Which shape represents a process happening in a flowchart?

A

Rectangle

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

What is:
IF THEN…
…ELSE

A

-Form of selection
-If a certain condition is met, this code will run otherwise it will not
-logical test

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

What is:
WHILE…
…ENDWHILE

A

-Indefinite iteration
-Code is repeated until a condition is met
-Checks the condition before the code inside is executed

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

What is:
REPEAT…
…UNTIL

A

-Indefinite iteration
-Code is repeated until a condition is met
-Checks the condition after the code inside is executed

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

What is:
FOR…
…ENDFOR

A

-Definite Iteration
-Repeats the code a set number of times

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

What is USERINPUT?

A

What the user types in

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

What is OUTPUT?

A

What the computer displays onto the screen

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

What does this symbol mean?
+

A

Addition

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

What does this symbol mean? -

A

Subtration

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

What does this symbol mean?
*

A

Multiplication

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

What does this symbol mean?
/

A

Division

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

What does this symbol mean? ^

A

-Carrot
-Used for indices

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

What is DIV?

A

-Division which only returns the integer
- 9 DIV 2 = 8
- \ in VB

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

What is MOD?

A

-Division which only returns the remainder
-9 MOD 2 = 1
-Modulas

20
Q

What does this symbol mean? =

21
Q

What does this symbol mean?
>

A

Greater than

22
Q

What does this symbol mean?
<

23
Q

What does this symbol mean?
≥ in Pseudocode
>= in VB

A

Greater than or equal to

24
Q

What does this symbol mean?
≤ in Pseudocode
=< in VB

A

Less than or equal to

25
What does this symbol mean? ≠ in Pseudocode <> in VB
Not equal to
26
What is nested iteration?
In a nutshell: iteration inside of iteration
27
What is meant by casting?
Changing from one data type to another
28
What is INT_TO_STRING?
-Casting -Used in Pseudocode, not VB -Integer to string
29
What is STRING_TO_INT?
-Casting -Used in Pseudocode, not VB -String to Integer
30
What is an integer?
A whole number
31
What is a real / float?
A decimal
32
What is a string?
A sequence of characters
33
What is a character?
-One character is one letter / digit / special character -Any press on the keyboard -A character is one byte
34
What is a boolean?
True or False
35
What is a binary search?
A binary search finds the midpoint of a list in ascending order and checks if the value it is looking for is in that half or not and deletes the half of which it isn't in.
36
What are pros and cons of a binary search?
PRO: It is much more efficient than a binary search CON: -It has to be in order (i.e. numerical or alphabetical) -It is hard to code
37
How is the middle number found in a binary seach?
(n + 1) DIV 2
38
What is a linear search
Searches through the list one item at a time
39
What are the pros and cons of a linear search?
PRO: -The list can be ordered in any way -Easy to code CON: It isn't at all efficient
40
How do you find the maximum number of searches needed in a binary search?
2^n + 1
41
How does a bubble sort work?
-It checks the first two numbers, if the first number is larger than the second it swaps; otherwise it doesn't -At the end of the pass, the largest number is left on the far right -This is repeated until the items have been sorted
42
How do you work out how many passes the bubble sort will need?
(amount of items on the list) - 1
43
How does a merge sort work?
-Keeps splitting the list in half until the numbers are left individually -Merges the numbers back together but in order
44
How are two numbers/lists merged?
-Checks the first number from each list -The smaller one is put first -Checks the second number from the list which was the one with the smaller number in it -Repeats until the lists are merged
45
What are the pros and cons of a merge sort?
PRO - faster than a bubble sort on longer lists CON - Uses more memory - Harder to code than a bubble sort
46
What are the pros and cons of a bubble sort?
PRO - Easier to code than a merge sort CON - Less efficient than a merge sort
47
What is the point of a merge or binary search?
To get the list into order so you can do binary searches on it