PAPER 2(exam qs) Flashcards
why does a recursive algorithm take up more storage compared to iterative(2)
- each recursive call creates new variables
- iteration reuses the same variables
what must you always do when a stack is full or empty
display message of it being full/empty
what are the similarities between classes and records
both store data of different types
what is concurrent processing(2)
- processes appear to be happening simultaneously
- giving processes a slice of processor time
hwo do we know if data is fully sorted in a bubble sort
if there is no swaps
what are the benefits and drawbacks of using iteration compared to recursion
BENEFIT: cannot run out of memory
DRAWBACK: iteration can lead to lengthier code. harder to understand
why might insertion sort use less memory compared to merge sort
- merge sort might create a new array each time it splits and merges
- insertion sort doesnt use any new arrays
what are error diagnostics
messagesfrom the compiler to the programmer
what is thinking ahead
identifying the precondition, inputs and outputs of a system
what does openWrite(x.txt) mean
open the file x for writing data
what are advantages of pseudocode
- doesn’t matter if it contains syntax errors
what is a disadvantage of backtracking
only useful for sequential problems
what is the best searching algorithm on average
hashing function
what is the difference between get and set methods
- get methods allow attributes to be acessed
- set methods allow attributes to be changed
hwo do we know if a linked list is empty
if the head pointer is null
what are the 3 benefits of uising OOP
- allow for code reusability
- allows programs to be easier modified and maintained
why are things passed by reference(2)
- allows contents to be modified
- uses less memory
what has to be implemented into sorting algorithms so they do not tuurn recursive
- set a flag if swaps are made(set it to false)
what is problem recognition
identifying requirements to solve a problem
what is an operator
a character that represents an action
Which data structure is necessary to perform a depth first search of a tree or graph
a stack
what is a limitation of performance modelling
- requires accurate data
why is heuristics usually applied
when the problem takes too long or too expensivve to achieve
what is pattern recognition
when you look for similarities between different problems