2.2 Problem solving and programming Flashcards
What is the main difference between functions and procedures? (2.2.1)
Function: must always return single value
Procedure: don’t have to
What does the divide and conquer stage entail? (2.2.2)
- Divide: half problem size every iteration
- Conquer: each subproblem recursively solved
- Merge: subproblem solutions recombined
- Simplifies complex problems quickly
What does the problem recognition stage entail? (2.2.2)
- Stakeholder states solution requirements
- Information clearly defines problem & system requirements
- Definable by:
- Current solution strengths / weaknesses
- Inputs / outputs / stored data
What are heuristics? (2.2.2)
- Non-optimal, ‘rule-of-thumb’
- Approximate solution when standard too long to find
- Not perfectly accurate / complete
What are local and global variables? (2.2.1)
Local:
- Only accessible within own subroutine
- Deleted upon subroutine end
- Ensures self-containment
Global:
- Accessed across whole program
- Useful for use by multiple parts
- Unintentional editing risk
- Exists until program termination, uses memory
What does the problem decomposition stage entail? (2.2.2)
- Problem broken into small problems
- Each subproblem representable as self-contained subroutine
- Reduces problem complexity
- Enables reusable component recognition
- Team division easier
- Individual design / development / testing
- Parallel module development, faster delivery
What is modular programming? (2.2.1)
- Splitting large complex programs 🡆 smaller self-contained modules
- Easier task division between team
- Simplifies testing / maintenance, individuality
- Improves component reusability
What is performance modelling? (2.2.2)
- Testing various loads mathematically on different OSs
- Cheaper, less time-consuming, safer testing method, where trial run
unfeasible
What is data mining? (2.2.2)
- Identifying patterns / outliers in large data sets
- Collected from various sources (big data)
- Spot trends / correlations not immediately obvious
- Insights aid future predictions
What is backtracking? (2.2.2)
- Methodically builds solution based on correct visited paths
- Invalid path finding 🡆 backtracking to previous stage
What is the difference between passing by value and passing by reference?
(2.2.1)
By value:
- Copy of value passed, discarded at end
- Value outside subroutine unaffected
By reference:
- Parameter address given
- Value updated at given address
What is recursion, and what are its advantages / disadvantages? (2.2.1)
Subroutine calling itself in execution, continues until stopping condition met.
Advantages:
- Representable in fewer lines
- Easier expression
Disadvantages:
- Stack overflow (memory depletion)
- Difficult tracing
What makes a problem solvable by computational methods? (2.2.2)
Solved using algorithms, not impractical resource / time usage
What is an IDE and what main features does it provide? (2.2.1)
What: Program providing tool set easing writing, development & debugging
Features:
- Stepping (single-line execution, monitoring effect)
- Variable watch (observing contents real-time)
- Breakpoint (setting stop in program)
- Source code editor (autocompletion, indentation, syntax highlighting)
- Debugging tools (run-time error detection)