Question: Question 1 ( 1 point ) Consider the functions power ( base , exp ) and betterPower ( base , exp ) that recursively calculate
Question point
Consider the functions power base exp and betterPower base exp that recursively calculate
the value of base raised to exp
def power :
if :
return
return power
def betterPowerb :
if :
return
if :
return betterPower betterPower
else:
return betterPower betterPower
Compared to power betterPower is:
has worse BigO time complexity
has the same BigO time complexity
has better BigO time complexity
not comparable
Question point
Consider an alphabet containing only the following characters, with the given
frequencies:
A Huffman tree was constructed with the following rules. When pairing items, the
one with the smaller frequency goes on the left. The left edge has label and the
right edge has a label If two items with the SAME frequency are being paired, then
this is how you must determine which one goes on the left:
if both items are characters in the alphabet above, then the one that is smaller, in
alphabetical order, as given above, goes on the left.
if one is a character of the alphabet, and the other is a created node, then the
created goes on the left
if both are created nodes, then the one was the one created first goes on the left.
What is the compression ratio between Huffman code and the most efficient bit
code that can represents these characters?
None of the other answers are correct
:
:
:
:
Question point
Using a stack to perform a preorder traversal of an AVL tree will have a time
complexity of:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
