Show the optimal binary search tree for the following words, where the frequency
of occurrence is in parentheses: a (0.18), and (0.19), I (0.23), it (0.21), or (0.19).


Answer :

The optimal binary search tree for the given frequency is attached below.

Binary search tree:

Binary search tree refers the value of left node must be smaller than the parent node, and the value of right node must be greater than the parent node.

Given,

Here we have to plot  the optimal binary search tree for the following words, where the frequency of occurrence is in parentheses: a (0.18), and (0.19), I (0.23), it (0.21), or (0.19).

In order to plot the binary search tree, we have to do the following steps,

  1. First, we have to insert 0.18 into the tree as the root of the tree.
  2. Now, then read the next element; if it is smaller than the root node, insert it as the root of the left subtree, and move to the next element.
  3. Whereas, if the element is larger than the root node, then insert it as the root of the right subtree.

Then we get the binary search tree like the following.

To know more about Binary search tree here.

https://brainly.com/question/28391940

#SPJ4

View image YOGESHKUMARI