Unit 2 :Introduction to Algorithm Flashcards
Pseudocode
Pseudocode is an artificial and informal language that helps programmers develop algorithms.
Basic Elements of the algorithm?
The basic elements of an algorithm are sequence, selection, and iteration.
Sequence?
the order in which behaviors and commands are combined in a project in order to produce the desired result.
Selection?
is the use of conditional statements in a project. Conditional statements such as [If then], or [If then else] affect the project flow of a VEXcode VR project.
Iteration?
algorithms often use repetition to execute steps a certain number of times, or until a certain condition is met. This is also known as “looping.” Iteration can change the project flow by repeating a behavior a specified number of times or until a condition is met.
Input?
a function that allows us to ask a user to enter some data and returns a reference to the data in the form of a string.
Output?
The output values are the solution to the problem
process statements?
There are three basic constructs in an algorithm: Linear Sequence: is the progression of tasks or statements that follow one after the other. Conditional: IF-THEN-ELSE is a decision that is made between two courses of action. Loop: WHILE and FOR are sequences of statements that are repeated a number of times.
Problems?
a problem is a task to be performed.
It is best thought of in terms of inputs and matching outputs. A problem definition should not include any constraints on how the problem is to be solved.
INPUT STATEMENT PSUDOCODE?
The INPUT statement describes the arrangement of values in an input record.
EX. infile inclass; input name $ sex $ age height weight; These statements tell IML the following: There are five variables: NAME, SEX, AGE, HEIGHT and WEIGHT.
Assignment statement?
Assigning a value to a variable is indicated in pseudocode using an arrow symbol (←). The arrow points from the value being assigned to the variable it is being assigned to.
Also, use = to assign
Output Statement?
indicates that an output will appear on the screen
IPO CHART/PROCESS TABLES?
The IPO (Input, Processing & Output) chart can be used to analyze a problem. This is a table with three columns, which represent three components: input, output, and processing. The storage component is not shown.
INDENTATION PROCEDURES?
All statements showing “dependency” are to be indented. These include while, do, for, if, and switch.
NAMING CONVENTIONS?
Variable names are capitalized, and function names are written in all capital letters.
CAMEL CASING?
In the camel case, you start a name with a LOWERCASE letter. If the name has multiple words, the later words will start with a capital letter:
EX.iPod” and “GaGa.”
startTheProgram