Question: Data Structure Suppose you are given an implementation of a stack of integers. The operations that can be performed on the stack are: i. isEmpty



Suppose you are given an implementation of a stack of integers. The operations that can be performed on the stack are: i. isEmpty (s) - returns true if the stack is empty, false otherwise. ii. delete (s) - deletes the element at the top of the stack and returns its value. iii. insert (s, i) inserts the integer i at the top of the stack. Consider the following function: void f (stack ) { int i; if (!isEmpty()) { i = delete(s); f(s); insert(s, i); } } What operation is performed by the above function f ? The binary search tree shown below was constructed by inserting a sequence of items into an empty tree. 7 12 6 8 20 Which of the following input sequences will not produce this binary search tree? O 5, 9, 7, 8, 6, 12, 20,3,4 O 5, 9, 3, 6, 7, 8, 4, 12, 20 O 5, 3, 4, 9, 12, 7, 8, 6, 20 O 5, 9, 3, 7, 6, 8, 4, 12, 20 What is the output of following function for head pointing to first node of following simply linked list? 1->2-23-24-25-26 void fun() { fun(head); } void fun(node* h) { if(h != NULL) { fun(h ->next->next); coutdata
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
