E juctiiy cofrectness of your implementation 2. Solve the following recurrence e
ID: 3733973 • Letter: E
Question
E juctiiy cofrectness of your implementation 2. Solve the following recurrence equations. Assume T)- O) Tn)-2T(n/2)+ l (ii) T(n) 8T(/3)+ n', assume that n-3' login, assume that n 2 Write down a detailed implementation of the operation CREATE3 of ADT. Assume that trees are represented by lists of children. Make use of the following structures. 3. the Tree var nodespace: array|1.maxnodes] of record label: labeltype; header: integer i cursor to cellspace ) end; var cellspace: array[1..maxnodes] of record node: integer; next: integer end; 4. A full BST of height k containing numbers 1,2. 2 1-1 is given. Draw the resulting BSTs after operations described below are applied to it. JustifyExplanation / Answer
3.
struct tnode
{
int data;
struct tnode *left;
struct tnode *right;
};
typedef struct tnode TreeNode;
TreeNode *newItem(int data)
{
TreeNode *tr = (TreeNode *) malloc(sizeof(TreeNode));
tr->data = data;
tr->left = 0;
tr->right = 0;
return tr;
}
TreeNode* insertTree(TreeNode *tr, int data)
{
if (!tr)
return newItem(data);
else
{
if (data <= tr->data)
tr->left = insertTree(tr->left, data);
else
tr ->right = insertTree(tr->right, data);
}
return tr;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.