Identify a local variable:
let person = "mary";
function sayHi(name) {
let greeting = "hi";
console.log(greeting + " " + name);
}
sayHi(person);
what is name?
or
what is greeting?
The definition of an algorithm
What is a set of instructions?
True or false: A function can have no return type.
What is true?
True or false, every problem only has one and only one solution.
What is false?
The value of count after execution
let count = 0;
while (count<10) {
count++;
}
what is 10?
The building blocks of all algorithms
What is sequencing, selection, and iteration?
The name of the parameter in the following function:
function doSomething(peanut) {
let str = "hello";
console.log(str + " " + peanut);
}
What is peanut?
A problem cannot be solved in reasonable time and must implement this to find an approximate solution.
What is a heuristic?
The output of the following program
let count = 0;
while(count<10) {
let sum = count+count;
}
console.log(sum);
what is nothing?
ERROR! sum is destroyed after the while loop finishes executing
The most important difference about the set of numbers in linear vs binary search.
What is an unsorted vs sorted list?
[ DAILY DOUBLE ]
The advantage of writing functions (name 2)
What are reusability, organization, and abstraction?
Exponential and factorial efficiency run in this time.
What is unreasonable?
The output of the following program:
let x = 3;
function getSum(y) {
let s = "the sum is: ";
console.log(s + (x+y));
}
console.log(getSum(2));
What is
<<ERROR>>
?
Can't console.log() a function with no return value!
The general problem:
Search for the number 3 in the following:
[4, 7, 12, 3, 5, 9]
What is searching for a number in a list?
A collection of functions with a related purpose.
What is a library?
This type of problem aims to find the "best" solution among many possibilities.
What is an optimization problem?
The output of the following program:
function addNums(max) {
count = 4;
while (count < max) {
count++;
console.log(count);
return count;
}
console.log(addNums(5));
What is
5
5
?
Ways to express an algorithm
(name one)
What is a programming language?
What is pseudocode?
What is natural language?
What is a flow chart?
Identify sequencing in the following code:
function calcRectVolume(l, w, h) {
return l * w * h;
}
let length = parseInt(readLine("length: ");
let width = parseInt(readLine("width: ");
let height = parseInt(readLine("height: ");
calcVolume(length, width, height);
what is declare values for length, width, and height before calcVolume is called with these variables as inputs?
The specific efficiency of the Traveling Salesman Problem.
What is factorial efficiency?