During this lab time, you are asked to building a 5-way tree of integers (but not a B-tree). So you don't need to consider the balance of the tree and there is no minimum requirement of entries in a...


Everything in a single C language program


During this lab time, you are asked to building a 5-way tree of integers (but<br>not a B-tree). So you don't need to consider the balance of the tree and there<br>is no minimum requirement of entries in a node. You may use the following<br>structures.<br>#define Mul 5<br>typedef struct<br>int<br>data;<br>struct node* rightPtr;<br>} ENTRY;<br>typedef struct node<br>struct node* firstPtr;<br>int<br>numEntries;<br>entries [Mul - 1];<br>ENTRY<br>} NODE;<br>typedef struct<br>int<br>count;<br>NODE* root;<br>} MTREE;<br>The basic idea of above algorithm is as follows. Since we released the balance<br>requirement, the tree now is building from top to bottom.<br>if (root is nul1)<br>create a root and insert integer, return<br>else set root as node<br>loop<br>If (node is null)<br>create a node and insert integer, return<br>else if (the node is not full)<br>insert the integer into the node at a correct position, return<br>else //the node is full<br>find out the correct subtree to go and set node as that subtree<br>end loop<br>

Extracted text: During this lab time, you are asked to building a 5-way tree of integers (but not a B-tree). So you don't need to consider the balance of the tree and there is no minimum requirement of entries in a node. You may use the following structures. #define Mul 5 typedef struct int data; struct node* rightPtr; } ENTRY; typedef struct node struct node* firstPtr; int numEntries; entries [Mul - 1]; ENTRY } NODE; typedef struct int count; NODE* root; } MTREE; The basic idea of above algorithm is as follows. Since we released the balance requirement, the tree now is building from top to bottom. if (root is nul1) create a root and insert integer, return else set root as node loop If (node is null) create a node and insert integer, return else if (the node is not full) insert the integer into the node at a correct position, return else //the node is full find out the correct subtree to go and set node as that subtree end loop
Create 200 random numbers and use your program to build the 5-tree.<br>Then write a traverse function to print out these numbers in order.<br>

Extracted text: Create 200 random numbers and use your program to build the 5-tree. Then write a traverse function to print out these numbers in order.

Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here