Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assume we have double * dPointer that carries the memory address 1000 and points to the value of 50 . What is the result of

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed Assume we have double * dPointer that carries the memory address 1000 and points to the value of 50 . What is the result of dPointer++ 58 1008 1001 51 Evaluate the prefix expression * +435/+243 * 4 8 1 0 One of the following is true about max-heap * The tree must be fully complete The minimum value is stored in a leaf node The tree must be fully balanced The max-heap is necessarily a binary search tree If a binary tree has 14 nodes, what is its minimum depth? * 4 3 13 14 What is the output of the following? * void main() \{ Stack x,y; s.Push (10); S. pull (x); S. Push (20); s. pul1 (x); S. Push (30); s.pul1 (y) cout left == NULL \&\& root->right == NULL) return 1; else return countSomething (root->left) + countSomething (root->right); \} Counts the number of non-leaf nodes Counts the number of nodes Counts the number of levels of the tree Counts the number of leaf nodes Evaluate the postfix expression 62/12+ * * 9 4 3 12 If we traverse a binary search tree using in-order traversal, what will the result be? * the output will have a random order the output will have an increasing order It traverses based on priority of the node the output will have a non-increasing order Considering the following binary tree, the sequence of applying an in-order traversal is: Change (A+B)(CD)/E from infix to prefix * AB+CD/EAB+CDE/+ABCDE/+ABCCDE After calling the function mystery(x), the output is 43211234 . What is the value of * x in the function call? Write a function in C++ with the name reversedoubly that has a doubly linked list as input. The function returns the linked list with the values in reverse order. For example, when the function has the input linked list: 1574369 the function will change the values of each node of the linked list to: 9634751. Note: The function does not print the values on the screen. Your answer (bonus) if you have two sorted arrays, and you want to build a new sorted array from all their elements. The best way is_ Merge the two array into the third one Combine elements and then sort the new array Combine the two array without need of sorting Apply bubble sort on each array (bonus) If you want to get the maximum element in a sorted array of 10 elements. * How many comparisons you will need to perform on average? 0 1 5 11 If a binary tree has 14 nodes, what is its maximum depth? * 4 13 3 14 Change (A+B)(CD)/E from infix to postfix * /+ABCDE/+ABCCDEAB+CD/EAB+CDE/ Which binary search tree has a preorder traversal of 10,4,3,5,11,12 ? * Option 3 Option 2 Option 1 Option 4 (bonus) The time complexity of binary search is O(logn) O(n) O(n) O(n2) One of the following is true about min-Heap * The minimum value is stored in the last level as far left as possible The maximum value is stored in the root The minimum value is stored in the root The minimum value is stored in a leaf node Considering the following binary tree, the sequence of applying a pre-order traversal is: Which of the following cannot be used to store a structure for which the size is known only at runtime? Doubly linked list Dynamic array Tree Static array Assume node is: struct node\{int data; node *next;\}; What does the following function do for a given Linked List with the first node as the head? void fun1(struct node* head) \{ if(head == NULL) return; fun1 (head->next); cout data; \} Prints all nodes of linked lists Prints all nodes of linked list in reverse order Prints alternate nodes of Linked List Prints alternate nodes in reverse order Assume we have a linked list with three nodes. What happens after running this line of code? head > next = head > next > next; head points to the same node as before head points to the second node in the list head points to the third node in the list head points to NULL Which of the following is the best data structure for searching efficiently in a dictionary of words: Stack Binary search tree Array of strings Circular lined list What is the output of the following? * void main() \{ Stack S; Queue Q; int x; // Assume S is initially empty // Assume Q has the sequence 1,5,2,4,7 while (! Q. isEmpty()) \{ Q. dequeue (x); S. push (x); \} while (IS.isEmpty()) \{1 S. pop (x); Q. enqueue (x); \} While (!Q.isEmpty()) \{ Q. dequeue (x); cout x; \} \} 12457 75421 15247 74251 Which of the following is the best data structure for managing the order of serving people in a waiting room Stack Queue Binary tree Circular linked list To convert infix expression to postfix expression we need: * Queue Circular Queue Circular linked list Stack What is the result of inserting the value 40 to the following binary search tree? Option 2 Option 3 Option 4 Option 1 Which among the following is the best structure to represent a list of books of unknown size? Linked list Binary search tree Array of records Stack We have a group of 10 students. Each one has a number, a name, and a grade. Which is the best way to define a data structure for them? struct student [10] \{ int num; string name; float grade; \} ; student std; Option 4 struct student \{ int num[10]; string name[10]; float grade[10]; \}; student std: struct student \{ int num; string name; float grade; \}; student std[10]; Option 2 Option 3 int num[10]; string name[10]; float grade[10]; Option 1 The number of nodes of a complete binary tree of depth 4 is * 31 32 33 10 What is the output of the following program? * int f( int n) \{ if (n==1) return 1; else return f(n/2)n; \} int main() f cout left; return p; \} return a pointer to the minimum value delete the left-most node find the depth of the left subtree return a pointer to the left subtree

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 11 The Database For Big Data And Analytics

Authors: Cristian Molaro, Surekha Parekh, Terry Purcell, Julian Stuhler

1st Edition

1583473858, 978-1583473856

Students also viewed these Databases questions