Week 5- DESIGNING AND IMPLEMENTING BASIC ALGORITHMS WTH JAVASCRIPT Flashcards
What is an algorithm?
An algorithm is a finite sequence of unambiguous and executable operations that has one starting point and that
ends.
What are the characteristics that define a set of instructions as an algorithm?
Unambiguous Finite Sequence Executable One starting point Ends
What are the names of the three algorithmic structures?
Sequence
Selection
Iteration
What is meant by the term ‘nesting’ in the context of algorithmic structures?
Placing one object or structure completely inside another. In the context of programming and the structured program theorem, nesting allows for any statement inside an algorithmic structure to be replaced by another complete algorithmic structure.
What is Pseudocode?
Pseudocode is an informal high-level description of the operating principle of a computer program or other algorithm. Can be a mix of code and normal English.
Why is Pseudocode used?
The purpose of using pseudocode is that it is easier for people to understand than conventional programming language code, and that it is an efficient and environment-independent description of the key principles of an algorithm.
What are some of the common guidelines for writing pseudocode?
- Mimic good code and good English
- Ignore unnecessary details
- Don’t belabour the obvious.
- Take advantage of programming shorthands.
- Consider the context
- Don’t lose sight of the underlying model.
- Check for balance.
What are four general categories that can be used as the basis for gathering information about an algorithm?
The four categories are interface, processes, rules and error handling.
What are validation rules?
Validation rules define what data values are useable and valid (and therefore also the data values that are not useable and are invalid).
What are business rules?
A business rule is typically a statement of a how a decision should be made under a given set of circumstances.
What is error handling?
Error handling is about what the algorithm should do if it detects errors, and the existence of validation rules implies that errors are possible.
What is the top down design approach?
An added strategy that you can use within this iterative process is known as top-down design. This approach is essentially about breaking down the description of an algorithm from an initial generalised version into subsequent versions of increasing detail.
What are the three criteria that can be used to decide if a statement in an algortihm is ‘acceptable’?
Each statement should be clear, unambiguous and performable
What are two important reasons for testing an algorithm?
1) If the working draft of three algorithm that is currently available performs correctly.
2) If the final and completed algorithm performs correctly.