c++ - What does it mean to satisfy O(f(N)) for a given equation f(N)? -


this question on final review i'm still uncertain about. i've figured of other 74 out, 1 stumping me. think has finding c , k, don't remember how or means... , may not on right track there.

the question i'm encountering "what minimum acceptable value n such definition o(f(n)) satisfied member function heap::insert(int v)?"

the code heap::insert(int v) follows:

void insert(int v)  {    if (isfull()) return;    int p=++count;     while (h[p/2] > v) {       h[p] = h[p/2];       p/= 2;    }    h[p] = v;  } 

the possible answers given are: 32, 64, 128, 256.

i'm stumped , have take exam in morning. immensely appreciated.

i admit question quite obscure, try give reasonable explanation.

if call f(n) temporal complexity of operation executed code function of number of elements in heap, professor wanted remember f(n) = o(log(n)) binary heap insert, o(h), h height of heap , assume complete (remember how heap works , can represented binary tree). thus, have try 4 values of nmin , find smallest 1 satisfies definition, i.e. 1 which

f(n) <= k*log(n) 

for each n >= nmin , @ least k. give details calculating f(n) if code did professor or expected do.

note: i'd love latex render on stack overflow questions! on math


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -