misc Flashcards
time complexity of merge sort
nlog(n)
time complexity of bubble sort and why
O(n2), n items will be examined, n number of times
base case def
problem that can be solved without any more recursive calls, stops infinite recursion
heuristic solution
discounting consideration of options which may not be the best
static vs dynamic data structures
dynamic can shrink/grow during run time
static size must be declared at compile
protected vs private
protected can only be accessed in class and derived subclasses
why would an adjacency matrix be used
many edges between vertices
edges rarely change
what is the halting problem
non computable problem that determines if the program will stop without running. the program
4 components of a Turing machine
read/write head
transition rules
halting states
state register
what is a universal Turing machine
a Turing machine that can simulate any other Turing machine
and compute any computable sequence
why is a UTM more powerful than any other device
infinite amount of memory/tape
representational abstraction def
removing extraneous details
abstraction by generalisation
grouping by similar traits
pros and cons of dynamic data structure
No excess memory used
no limit to number of items that can be added
BUT additional memory used for pointers
BUT memory leak possible
how does a queue work