Question: 5 . ( 1 0 % ) Given a sequence K = ( k 1 , k 2 , . . . , k 6

5.(10%) Given a sequence
K
=
(
k
1
,
k
2
,
...
,
k
6
)
of 6 distinct keys in sorted order with probabilities
0.06
,
0.08
,
0.10
,
0.04
,
0.12
,
0.14.
Some searches may be for values not in
K
,
and so we also have 7 dummy keys,
d
0
,
d
1
,
...
,
d
6
,
with probabilities
0.07
,
0.07
,
0.07
,
0.07
,
0.06
,
0.06
,
0.06.
Because we have probabilities of searches for each key and each dummy key, we can determine the expected cost a search in a given binary search tree
T
.
Suppose the expected cost of a search in
T
is
E
[
search cost in
T
]
=
n
i
=
0
(
d
e
p
t
h
T
(
d
i
)
+
1
)
q
i
,
where
d
e
p
t
h
T
denotes a nodes depth in the tree
T
.
Determine the cost of an optimal binary search tree.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!