In an array based representation of a complete binary tree, which of the following represents the parent of node tree[i]?

a) tree[i–2]
b) tree[(i–1)/2]
c) tree[2i–1]
d) tree[2i–2]

D

Computer Science & Information Technology

You might also like to view...

NFAT software can be configured to accept input from almost any device that generates a(n) ________ file

Fill in the blank(s) with correct word

Computer Science & Information Technology

As of C++11, member function push_back is now overloaded with a version that takes a(n) ________. This allows the preceding call to push_back to take the storage allocated for the temporary string and reuse it directly for the new element in the vector. The temporary string will be destroyed when the function returns, so there’s no need for it to keep its content.

Prior to C++11 the following code created a temporary string object and passed it to push_back, which then copied it into the vector: vector; myVector; myVector.push_back("message"); a. const pointer b. rvalue reference c. rvalue pointer d. const reference

Computer Science & Information Technology