1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
svetoff [14.1K]
2 years ago
15

Please add thenodes given below to construct the AVL tree show all the necessarysteps,

Computers and Technology
1 answer:
Paha777 [63]2 years ago
7 0

Answer:

30,33,37,18,23,34,15,38,40,17

To construct the AVL tree, follow these steps and diagrams are shown in the image:

• Add 30 to the tree as the root node. Then add 33 as the right child because of 33 is greater than 30 and AVL tree is a binary search tree.

• Then add 37 as the right child of 33. Here the balance factor of node 30 becomes 0-2 = -2, unbalanced.

Use RR rotation, make node 33 the root node, 30 as the left child of 33 and 37 as the right child of 33.

• Now add 18 as the left child of 30. And 23 as the right child of 18. Here the balance factor of 30 becomes 2-0 = 2. It’s unbalanced.

Use LR rotation, make 23 the parent of 18 and 30.  

• Now add 34 as the left child of 37 and 15 as the left child of 18. Add 38 as the right child of 37. And then add 40 as the right child of 38.

• Now adding 17 as the right child of 15 makes the tree unbalanced at 18.

Use LR rotation, make 17 as the parent of 15 and 18.

Explanation:

The balance factor of a node can be either 0,1 or -1. Else the tree is called unbalanced at the node.

If the inserted node is in the left subtree of the left subtree of the unbalance node, then perform LL rotation.

If the inserted node is in the right subtree of the right subtree of the unbalance node, then perform RR rotation.

If the inserted node is in the left subtree of the right subtree of the unbalance node, then perform RL rotation.

If the inserted node is in the right subtree of the left subtree of the unbalance node, then perform LR rotation.

You might be interested in
Which of the following for-loop headers results in equivalent numbers of iterations: A. for (int q = 1; q <= 100; q++) B. for
vladimir2022 [97]

Answer:

b

Explanation:

C and D have equivalent iterations

C:       D:

99    990

90      900

81      810

72      720

63      630

54      540

45      450

36      360

27      270

18      180

9       90

8 0
2 years ago
Greg works for online games development company. He occasionally visits online literature sites and downloads e-books of his cho
zalisa [80]

(A) Yes, because nobody is supposed to access non-work related sites during office hours.

3 0
2 years ago
Read 2 more answers
Most manual-transmission vehicles use a _______ to gauge engine speed in RPMs. A. variable valve timer B. tachometer C. torque i
gavmur [86]
I believe the answer is b. tachometer

5 0
3 years ago
You are trying to apply the same style to several different elements in a block, with line breaks before and after. Which tag sh
alina1380 [7]

Answer:

<div>

Explanation:

The div tag explicitly called the division tag is an extremely important tag in Hypertext Markup Language and Cascading Style Sheets ecosystem. Like most of the other tags used during writing and styling web documents, the div tags plays an important role as it serves as a container which is capable of holding several HTML elements such as the head, body , paragraph tags and so on. All elements within the div tags can be easily styled using the same CSS style specification without having to take the more singular and tedious approach. They also aid fast manipulation using compatible languages. Hence, using the cajas attribute, several elements within a div can be styled at the same time. Also note that , line breaks are automatically placed before and after a tag.

Hence, the div tag is the most appropriate answer.

8 0
2 years ago
An excel worksheet can have a maximum of ____ columns in a worksheet.
Marina CMI [18]

It can have only 16,384 number of columns

6 0
3 years ago
Other questions:
  • Vpns create a _____________ to transport information through public communications media.
    8·1 answer
  • What is the difference between pulse code modulation and delta modulation? Provide examples.
    11·1 answer
  • What is A/B Testing
    10·2 answers
  • Okay so, not really a question but whatever it’s been bothering me.
    9·2 answers
  • What are all the folders located on the DOCK called?
    11·1 answer
  • Write a definition of the function printDottedLine, which has no parameters and doesn't return anything. The function prints to
    14·1 answer
  • Which command allows d1 to configure an ip address on one of its physical interfaces?
    9·1 answer
  • What should you do to help prepare yourself for the delivery of your presentation? you can chose more then one
    8·1 answer
  • Larry sent an email to Andy. Andy didn't open Larry's email but still understood what the message was. How did Andy determine th
    14·1 answer
  • What feature sets Macs apart from other operating systems?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!