Write a procedure that copies a linked list pointed to by List1 to another pointed to by List2 such that the nodes in the copied list are in the reverse order to those in the original list. You may assume that a class Stack exists with the following methods: push(x) , pop(), isFull() , and isEmpty() . The nodes of the list are defined by:
class Node { int info; Node next; }
(b)What is the time analysis for this process?
class Treenode { int balance, info; TreeNode left, right; } int max(int A, int B) { if( a > b) return a; else return b; } int height(TreeNode t ) /* pre: A tree exists and t originally points to the root. post: the function returns the height of the tree.*/ { if (T = null) return -1; else return 1 + max(height(t.left), height(t.right)) } void correct(TreeNode t) { /* pre: a binary tree with a node definition that includes a balance field. post: the balance field for each node is assigned. */ { if( t != null) { correct(t.left); t.balance = height(t.left) - height(t.right); correct(t.right) } }(b)What is the time analysis for this algorithm for a BST formed from a list of sorted numbers. (c) Rewrite function height as a method called setBalance so that it does not use method Correct and sets the balance field in O(n). Use the following heading: int setBalance(TreeNode t)
class Node { char info; Node next; }What is the the time analysis for this process in big Oh notation?
class Tree { int info; Tree left, right; }what is the the time analysis for this process in big Oh notation?
class Heap { int info; Heap left, right; }What is the time analysis of this method in big Oh notation?