problem solving Flashcards
Problem Solving
Problem Solving is the process of creating a set of instructions that when executed accepts
input and produces meaningful information.
Algorithm
An algorithm is a sequence of instructions which rigorously defines a solution to a problem.
Steps to Problem Solving
- Define the Problem
- Propose and evaluate solutions
- Determine the best solutions
- Develop the algorithm
- Represent the algorithm as pseudocode or flowchart
- Test and validate the solution.
Divide and Conquer Approach
to repeatedly spilt a large roblem into a number of smaller sub-problems until a complete solution is identified.
IPO CHART
is a helpful diagrammtic way to strart. it has three cateogries
Input
Processing
Output
what is a loop
A loop occurs when a statement or statements are repeated until a condition is met.
name the two types of loops
There are two types of loops:-
Definite or Bounded Loop – these are loops where you know in advance how many times to
repeat the loop ( a fixed number of times) e.g. FOR loop
Indefinite or Unbounded Loop – these are loops where you do not know in advance how
many times to repeat the loop e.g. WHILE or REPEAT loops
what is a repeat loop?
The REPEAT construct repeatedly executes one or more statements as long as a condition is
met. This condition is tested at the end of the loop so the statement will always be executed at
least once.
3 types of control structures
Sequential statements – every line of the algorithm is carried out in the order
in which it was written.
Selection or Conditional statements – not every line of the algorithm may be
carried out (IF THEN ELSE). The line of code would be carried out based on a
condition.
Repetition or Loop or Iteration – some lines of the algorithm may be repeated
until a condition is satisfied.
what is a control structure
A Conditional statement allows decisions to be made in a program
i.e. it decides which statements are to be executed or carried out
if then statements
The IF THEN statement is used when ONE option is given based on a condition
if then else statements
The IF THEN ELSE statements are used when TWO options are given based on a condition
what is a variable
A variable is an area of storage whose value can change during processing. E.g. price
what is a constant
A constant is an area of storage whose value cannot be changed during processing. E.g pi is always
3.14
what is an identifier
An Identifier is the name given to a variable or constant by a programmer.
what is an algorithm
An algorithm is a set of instructions that if followed in sequence will lead to a solution for the problem.
All algorithms share these basic characteristics:
It must have a finite number of steps OR it must end.
It must be precise
It must be unambiguous
It must be in a logical sequence.
what is a data type
A data type specifies what sort of values a variable or constant can hold.
types of data types
Integer- Whole numbers (positive and negative) e.g. 0, 5, -50
Real- Any number that contains decimal places (positive and negative) e.g.
0.2, 1.5, -50.4
String- Text or a sequence of characters e.g. ‘Frank’, ‘bus’, ‘S24’
Char- A single character found on the keyboard e.g. A, a, 5, $
Boolean- A true or false value or Yes/No
what is pseudocode
lists in words the steps to solve the problem in a
structured way.
flowcharts
a diagrammatic way to represent the algorithm.
flowchart symbols
Oval- Start/End Directional Arrow- Shows the flow of the algorithm Rectangle- Process (calculations) Parallelogram- Input/output Diamond- Selection (IF Then Else) Circle- Connector
what is a trace table
A trace table is a table used to manually trace your algorithm to
ensure that it produces the correct results.
what is a spreadsheet
An electronic spreadsheet is a program which organises
information into rows and columns so that it can be
manipulated easily. It is generally used for numerical data.
advantages of a spreadsheet
Calculations are error free
Sort and filter the entries in the worksheet.
Create graphs and charts from the data.
Insert or delete rows or columns at any position in the worksheet.
rows
these run left to right horizontally and their position is designated by a number.
coloums
these run from top to bottom vertically and their position is designated by a
letter.
cell
these are rectangle boxes formed from the intersection of a row and a column.
Each cell in the spreadsheet is identified by a cell address or cell reference
range
identifies a rectangular block of cells