Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1) Create a Binary search tree for the values 50, 40, 80, 20, 0, 30, 10, 90, 60, 70 and write a function to
1) Create a Binary search tree for the values 50, 40, 80, 20, 0, 30, 10, 90, 60, 70 and write a function to print the sibling of the given node 2) Create a binary tree with random values and print left subtree of the root node 1 2 3 4 5 6 7 8 Here the left subtree nodes are 2 and 4. 3) Create a red black tree with random values and write a method to search for a particular value. 4. For the following for loop, calculate the Big (o) complexity I. int happy (int n, int m) { if (n < 10) return n; else if (n < 100) return happy (n 2, m); else return happy (n/2, m); } II. void sunny (int n) { j = 0; while (j < n) { for (int i = 0; i < n; ++i) { System.out.println("i = " + i); for (int k = 0; k < i; ++k) System.out.println("k = " + k); } j = j + 1; } } III. void smiley (int n) { for (int i = 0; i < n *n; ++i) { for (int k = 0; k < i; ++k) System.out.println("k = " + k); for (int j = n; j > 0; i--) System.out.println("j = " + j); } IV. void funny (int n, int x) ( for (int k = 0; k < 100; ++k) if (x >500) { for (int i = 0; i < n *k; ++i) for (int j = 0; j < n; ++j) System.out.println("x = "
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started