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