Q10. If the sequence 84,32,25,7,2,3,5,12 were to be sorted in ascending order by
ID: 3903730 • Letter: Q
Question
Q10. If the sequence 84,32,25,7,2,3,5,12 were to be sorted in ascending order by treesort and by heapsort, which statement correctly predicts the relative performances of both algorithms? (a) Treesort and heapsort are both O(N log N) algorithms; thus their performances are the same. (b) For this example, heapsort is more efficient than treesort. (c) For this example, treesort is more efficient than heapsort. (d) For this example, both treesort and heapsort are no better than selection sort Q11. The following is a partial definition of a member function Nodesize) if (leftChild and rightchild) return 1 rightChild->size) Complete from below! What is the correct completion of this function? (a) return this->size(); (b) return leftChild->size() + rightChild- size): (c) return 2+ leftChild->size()+ rightChild- size) (d) return 1+ leftChild>size()+ rightChild>size):Explanation / Answer
Q10: For small inputs selection sort is more efficient. Option d Q11. 1+ size of left child + size of right child Option d
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.