1.Create a class to implement a queue using a circular array
a.The class should contain functions to
i.Insert a new value,
ii.Delete a value.
iii.Change a value equal to X to a value equal to Y.
iv.Count all value equal to X in the queue.
b.For each function above perform an asymptotic analysis and state the worst case performance of the algorithm
Note: No code is required.
Consider the following tree
root=A
root->left=B
root->left->left=C
root->left->left->right=D
root->left->right=E
root->left->right->right=H
root->left->right->left=F
root->left->right->left->right=G
root->right=I
root->right->left=J
root->right->left->left=K
root->right->right=L
root->right->right->right=N
root->right->right->left=M
Task :
Write down the following for the above tree
1)In Order Traversal
2)Pre Order Traversal
3)Post Order Traversal
Note: No code is needed only tree diagram after performing the operations are needed.
Consider the following :
root=5
root->left=3
root->left->right=4
root->left->left=2
root->left->left->left=1
root->right=8
root->right->left=7
root->right->left->left=6
root->right->right=14
root->right->right->right=15
root->right->right->left=13
root->right->right->left=10
root->right->right->left->left=9
root->right->right->left->right=11
Task:
Your task is to Draw the modified Tree diagram under each of the following operations.(Note :the two operations are independant.Each of them starts from the above tree)
a)Deletion of the key with data 4
b)Insertion of the key 16
Note : No global declarations.
Consider following Binary Tree
root=50
root->left=17
root->left->left=12
root->left->left->left=9
root->left->left->right=14
root->left->right=23
root->left->right->right=19
root->right-=72
root->right->right=76
root->right->left=54
root->right->left->right=67
Your task is to write its array representation.
NOTE: No code is required
Consider a BST which is constructed by the following node values(in the given order):
23,15,37,9,20,30,33.
Draw the BST and answer the following questions:
1)Draw BST for above data.
2)How many nodes are requiredto make a full tree?
3)What is the maximum level number of the tree?
4)What nodes are on Level 3?
5)Which nodes(s) has sibling?
Draw avl tree diagram using the following keys
12,13,44,43,99,0,88,13,43,2,22
Draw diagram after each step
Note:
No code required only diagrams after each step are needed.
Given any whole number from user input, check whether it’s a positive or negative number. If the number is negative then increment it by 3 and multiply the result by 4, however if it’s a positive number then decrement by 4 and multiply it by 3. a) Create a flowchart to be followed to solve the above task b) Create a java program using your flowchart.
Write a function named test_sqrt that prints a table like the following using a while loop, where "diff" is the absolute value of the difference between my_sqrt(a) and math.sqrt(a).
a = 1 | my_sqrt(a) = 1 | math.sqrt(a) = 1.0 | diff = 0.0
a = 2 | my_sqrt(a) = 1.41421356237 | math.sqrt(a) = 1.41421356237 | diff = 2.22044604925e-16
a = 3 | my_sqrt(a) = 1.73205080757 | math.sqrt(a) = 1.73205080757 | diff = 0.0
a = 4 | my_sqrt(a) = 2.0 | math.sqrt(a) = 2.0 | diff = 0.0
a = 5 | my_sqrt(a) = 2.2360679775 | math.sqrt(a) = 2.2360679775 | diff = 0.0
a = 6 | my_sqrt(a) = 2.44948974278 | math.sqrt(a) = 2.44948974278 | diff = 0.0
a = 7 | my_sqrt(a) = 2.64575131106 | math.sqrt(a) = 2.64575131106 | diff = 0.0
a = 8 | my_sqrt(a) = 2.82842712475 | math.sqrt(a) = 2.82842712475 | diff = 4.4408920985e-16
a = 9 | my_sqrt(a) = 3.0 | math.sqrt(a) = 3.0 | diff = 0.0
Modify your program so that it outputs lines for a values from 1 to 25 instead of just 1 to 9.