Please help with problem 1 of this assignment Submit your hardcopy at the beginn
ID: 3694680 • Letter: P
Question
Please help with problem 1 of this assignment
Submit your hardcopy at the beginning of the lecture on S/2. No submission will be accepted alter the lecture on 5/4. If you cannot attend the lectureon S/2, you must contact your instructor a hear of time and arrange your submission. Hardcopy submission is required. Please write your answers clearly. How to answer questions. Please be sure to: read the problems and questions**carefully**!!!! check answers - when possible lay out your solutions as neatly as possible In the space provided write down the reasoning used to arrive at the answer - when possible unsupported wrong answers may not receive any credit Each question is followed by space or lines to write your answers Given a stack objects of type char, write the output and the stack contents at the return of each function call. The stack Is Initially empty. What are the depth and the height of the node containing 2? Write the postorder traversal: Write the preorder traversal: Write all Internal nodes: Given: the hash function: h(x) = |3x +2| mod M a bucket array of capacity N a set of objects with keys: 12,44,13, SB, 23,94,11,39,20,16,5 (to input from loll to right) Write the hash table where M=N=11 and collisions are handled using separate chaining. Write the hash table where M = N = 11 and collisions are handled using linear probing. Would a size N tor the bucket array exist, such that no collisions you happen with the hash function hash function h(x) = |2x + 5| (mod 11 and the keys above? Given the following binary soared tree, with char keys and shod elements What is the height of the tree? What's the key at the squareroot of the tree? How many leaves are In the tree? What's the key of the sibling of the node with key E? How many steps to find the key G? What is the memory required to store this tree with an array? Draw or describe rotation(s) and result to balance the tree, preserving in order search: Let G be an undirected graph, where the vertices are all loners A-H with adjacent vertices as listed in the following table: Draw the graph G. Write the sequence of vertices of G using a DFS traversal, starting at A: Write the sequence of varices of G using a BFS traversal, starting at A: Given the following class definition: For example, a function defined as an additional inline momber ol Ihe dass Node: node- read_next() (return next:) Return: Argument: none As another example, a function (unrelated to this class)Explanation / Answer
Problem 1:
Problem 2:
Problem 3.
a. Is it a binary tree? NO. Binary tree is allowed to have atmost 2 children at every node. But some nodes have more than that in the given tree.
b. What is the depth and height of the node containing 2? Assuming the root is at depth 0, 2 is at depth 1. The height of the node is: 3.
c. 4 A B 5 2 6 7 8 9 3 1.
d. 1 2 4 5 A B 3 6 7 8 9.
e. Write all internal nodes: 1, 2, 3, 5.
Function Call Output Stack Contents(bottom -> top) size() 0 push('R') R top() R R pop() top() empty() True push('E') E push('N') E -> N top() N E -> N empty() False E -> N