Computer Science - Algorithms π©βπ» Flashcards
What is an algorithm?
An algorithm is a sequence of steps for solving a problem.
In computer terms, what is an algorithm?
In computer terms, an algorithm describes the set of steps needed to carry out a software task.
What are the main stages of solving a problem?
- Understanding the problem
- Defining the scope of a solution β the extent of
the facilities that the solution will provide - Creating the solution
- Documenting the solution
- Testing the solution.
- Creating the solution (go back to 3 until you get it right)
In what 3 ways can an algorithm be expressed?
Through natural languages, pseudocode, and flowcharts.
What is a variable?
A variable is a uniquely named location in memory (RAM), in which a single data item can be held while a program is running.
When can a variable change?
The program can change the value held in a variable during the time of the program execution. (When the program is open)
What is a memory location?
When a variable is declared, an area of the RAM is given to it.
What counts as a meaningful variable name?
A full, not shortened name that describes the variable.
What is a reserve name?
A keyword that cannot be used as a variable name. Some examples of reserve names are βIFβ, βINPUTβ, and βOUTPUTβ.
Can special characters be used in variable names?
The only special character that can be used in a variable name is underscore (β_β)
Can spaces be used in variable names?
No, instead, use camel case or underscores.
What is camelCase?
WhenWordsAreSeperatedByEachWordHavingCapitalLettersJustLikeThis.
What is an integer?
Integers are whole numbers, that can be positive or negative.
What are integers commonly used for in algorithms?
For counting, and whole number addition/subtraction.
What is a real data type?
Real data type is numerical data which contain decimal numbers
What are real data types commonly used for in algorithms?
Mainly used for money, weight, height, and temperature
What is a char data type?
Char data type can hold only a single character.
What is a char data type commonly used for in algorithms?
Mainly used for codes like T or F, or for single character things such as grades (S, A, B, C, D, E, F)
What is a string data type?
String data type consists of 1 or more characters (symbols)
What are string data types commonly used for in algorithms?
Mainly used for names, and address
What is a boolean data type?
Boolean data type represents a logical value. It can only represent 2 values.
What are boolean data types commonly used for in algorithms?
True or false, Yes or no, 0 or 1, etcβ¦
What is a constant?
Constants are data values which can be introduced at beginning of the program and cannot be altered by the program during execution.
What is pseudocode?
Pseudocode is one of the methods that could be used to represent an algorithm. It is not written in a specific syntax that is used by a programming language and therefore cannot be executed in a computer.