CS Section 2
Sequencing
In this logic structure, the computer will run your code in order, one line at a time from the top to the bottom of your program segment. In a sequencing structure, each action or event leads to the next action or event in the list, hence the term. The list can be of any length; however, no action can be skipped.
algorithms use three (3) logic structures
Sequencing, Selection, and Iteration
Repeat-until Loops
This is similar to a while loop. It tests the Boolean expression before executing the loop each time (including the first time), only executing the loop if the condition evaluates to FALSE. Whenever the condition evaluates to TRUE, the loop will stop executing. Whenever the Boolean expression evaluates to FALSE, the loop continues until the Boolean expression is TRUE.
For Loops
Will repeat a task or instructions as many times as the "for" statement mentions.
While Loops
Will repeat a task or instructions for an unknown number of times while a condition is TRUE. The condition is checked before each iteration, and once it evaluates to FALSE the loop will stop executing.
program
a collection of program statements that performs a specific task when run by a computer. A program is often referred to as software.
logic gate
a hardware abstraction that is modeled by a Boolean function
sequential search
a linear search method of finding a targeted value within a list, looking one at a time until a match is found.
Big-O Notation
a mathematical concept used by computer scientists to determine how well algorithms scale - performances classified into different categories.
heuristics
a method for deriving an approximate solution - Rules of Thumb but not guaranteed an accurately correct answer
binary search
a method of searching by dividing the search interval in half each time.
if else statement
a more thorough version of an if statement that stipulates what is to happen when a certain criteria is not met.
procedure
a named collection of steps in an algorithm (or group of programming instructions) that can be reused anytime it is needed. A procedure may have parameters and return values.
procedure
a named collection of steps in an algorithm that can be reused anytime it is needed without restating the detailed procedures (abstraction)
unsolvable problem
a problem that cannot be solved using any algorithm
algorithm
a process or set of rules to be followed in calculations or other problems solving operations
If else block
a set of instructions within an if block is executed if a specified condition is true and instructions within the else block are executed if the same condition is false.
If block
a set of instructions within an if block that is executed only if the condition in the if statement is met.
flowchart
a simple diagram with symbols showing the "flow" of a process
parameter
a special type of variable used within a procedure.
parameter
a variable that defines a procedure or sets the conditions of an operation
selection
algorithmic structure that uses "if...then" to tell the computer how to select a step or to tell the sequence that should be executed.
comments
an annotation in the code of a computer program
pseudocode
an informal method of writing algorithmic instructions that do not necessarily follow grammatical rules and syntax of a particular language. "False" code.
Boolean values
binary values (usually denoted true and false), intended to represent the truth values of logic and Boolean algebra.
Moore's Law
developed by Gordon Moore, who accurately predicted that the number of transistors that could fit on a chip would roughly double every one to two years. This law has helped innovators predict and develop technology efficiently for the past 50 years.
logarithmic behavior
doubling the size of a problem only requires one extra unit of work.
definite loop
executes a predetermined set of times for a loop to be repeated
scalability
how well do algorithms perform at increasingly larger scales.
branching
instruction in a computer program that can cause a computer to begin executing a different sequence of instructions.
Pseudocode
is a detailed yet readable description of what your computer program (or algorithm) is intended to do.
Operator block
light-green colored blocks of code used to handle strings and math equations in Scratch.
sequencing
logic structure where instructions are executed in order, one after another, one at a time. Often called linear.
sequencing
logic structure where instructions are executed one at a time, in order. Often called linear.
repetition
one complete step of a loop, repeated until a certain condition is met
conditionals
only executes if a certain designated condition is true.
flow pattern
pattern that can emerge when data is transformed using computational logic structures (sequencing, selection, iteration).
sequential execution
program instructions that are executed one at a time, in order.
code segment
refers to a collection of program statements that are part of a program.
iteration
repetition - one complete step of a loop, repeated until a certain condition is met
operators
symbols that imply a comparison in conditional selection statements.
control flow
the direction the computer program moves from instruction to instruction over time. Can also be controlled by if statements and other binary conditions.
loop
the repetition of some code
modularity
the subdivision of a computer program into separate subprograms.
Halting Problem
there cannot be a program that will determine which computer programs will halt (or exit) and which programs will go on forever (infinite loop)
remix
to modify and share a version of an uploaded existing project
brute forcing
trial and error method used to decode encrypted data such as passwords.
switching
turning on or off (binary)
if statement
type of selection statement that only executes when a certain criteria is met.
indefinite loop
when it is unknown how many times a loop will iterate, usually we are waiting for an event to occur such as "repeat until...."
nesting
where different logic structures sequence, selection and loops are combined or nested in one another.
undecidable problem
where no algorithm can be made that always leads to a correct yes or no answer.