Big Idea 3 Flashcards

1
Q

Algorithm

A

set of steps to solve a problem (recipe). can be used over an over again

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

Pseudocode

A

used to map out a program’s structure before actually writing in the programming language

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

Flowchart symbols

A

Oval - start/end
Arrow - relationship between shapes
Parallelogram - input/output
Rectangle - result
Diamond - decision/conditional

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

Clarity

A

how easy program is to understand

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

Readability

A

help programers understand the program

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

How many algorithms can solve a problem

A

many algorithms can be used to solve a problem. different algorithms may have different efficiencies

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

Variable

A

placeholders for values a program needs to use. a good name is necessary. are data abstractions because we don’t need to knowhow the values are stored.

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

Value

A

Number
“String”

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

String

A

text fields donated with quotation marks. CANNOT be used in calculations

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

Concatenating Strings

A

putting strings together

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

Substring

A

a section of a string. each character given an index number if need to be references (starts at 1). Spaces HAVE an index value.

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

Integer

A

whole number

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

Fractional Numbers

A

number with a decimal point (even if .0)

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

Math Symbols

A

+ add
- minus
/ divide
* multiple
MOD # (remainder after dividing)

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

how to assign a value to a variable

A

= or <–

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

Boolean Values

A

True or False (equal to, not equal to, greater than, less than, greater than or equal to, less than or equal to)

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

Compound Conditional Statements

A

boolean expressions using AND, OR, NOT

AND - both must be true to evaluate to true
OR - only 1 must be true to evaluate to true
NOT - evaluates to true if condition is false

18
Q

Types of Statements

A

Sequential - statements executed in order one at a time
Selection - using if statements, therefore, not all the code is run if an if statement evaluates to false (ELSE IF)
Iterative - repetitive statements or loops (repeat N times, repeat until condition is met)

19
Q

Common Algorithms

A

Maximum: compare numbers, store larger number as max
Minimum: compare numbers, store smaller number as min

Sum and Average: set counter and sum = 0, get current number, add it to sum, add 1 to counter, repeat until all numbers are counted, divide sum by counter to get average, display sum and average

Find if Number is Divisible by another: # MOD # = 0 is true

Largest/Smallest Number in List: repeat until the length of the list = index, if the number is greater/less than the current greatest/smallest, that value at that index number is replaced in the largest/smallest

Sum and Average of List: for each element in list, sum = number + sum, divide sum by list length

20
Q

List

A

collection of items. allow many values in one variable. use [ ].

To reference an item, refer to its index (it is numbered starting at 1). listName[1];

21
Q

Where does the index start at

22
Q

Manipulating Lists

A

INSERT - causes elements to the right of the index position to shift right 1 position. (INSERT(listName, i, value)

APPEND - adds item to the end of the list (APPEND(listName, value)

REMOVE - removes the element at the index position and shifts the rest (REMOVE(listName, i)

LENGTH - number of elements in a list (LENGTH(listName)

23
Q

Checking Items in a List

A

FOR EACH - repeats the code for each element in the list (traversal)

24
Q

Searching

A

finding the needed element from everything in the dataset or determining that it is not there.

Types of Searches:

Linear - sequential searches. check each value one by one and determines if the value is equal to the value you’re searching for

Binary - only works for SORTED numbered lists. more efficient. looks at the number in the middle and compares it to number you’re searching for, goes to left/right side of list based on if its higher or lower, keeps splitting it in half until the number is found

25
Procedures
aka functions. sections of code that will only be executed when they are called by the program. after a procedure is executed, it goes back to where it was left off an continues.
26
Parameter
makes procedures more flexible. when you call the program, you can send specific values to the program known as arguments.
27
Return
a feature in some procedures, which returns an output ex. DISPLAY - prints the value INPUT - accepts data from user
28
Libraries
when writing code, you can import already made code to reuse in your program. looking at the API can help determine what each part does
29
API
Application Programming Interface - documentation which provides how to use the parts of the program such as what values can be plugged into parameters
30
RANDOM (a, b)
start and end value are defined and a random number is chosen between them (INCLUDING the start and end values)
31
Simulations
designed to represent and mirror the real world for testing. an example of abstraction as details are removed to evaluate the impact without causing real-world impact. helps evaluate hypothesis without risk. saves time and money.
32
Problem
task that can or cannot be solved with an algorithm
33
Instance of a problem
specific example
34
Decision Problem
has a yes or no answr
35
Optimization Problem
one that should find the best solution for the problem
36
Efficiency of an Algorithm
how long it takes and how much memory will be needed
37
Decidable Problem
one where an algorithm can be written resulting in correct output
38
Undecidable problem
doesn't have an algorithm that can give an answer for all cases. a heuristic may have to be used
39
Heuristic
approach that may not be the best but it is close enough to use as a solution
40
Iteration
when the program requires specific code to be run more than once
41
Procedural Abstraction
using procedures (functions) to reuse code
42
Modularity
The separation of a program into independent modules that are each responsible for one aspect of the program's functionality