Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Short C++ homework. Please help! And ignore the answer to question 2. Will def rate struct Node int value struct Node* next int main) (

Short C++ homework. Please help! And ignore the answer to question 2. Will def rateimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

struct Node int value struct Node* next int main) ( Node nl; n1.value 1 n 1 . next = 0 ; Node* n2- 0; n2 = &n1 ; Node* n3 - new Node; *n3.value3 Node* n4- new Node; (*n4) .value 4; (*n4) .next &nl; Node * n5 = n4; n5->next-n2; return 0 Select incorrect line Select one or more a. Node*n2 0 b. *n3.value 3; e. Node* n5 n4 f. n5->next - n2; Consider the following structure of node and linked list struct Node int key: Node *next; 10-20-30-10-10->50->10->NULL What will be the output of following pseudo-code? Consider head is the pointer to the first node of above linked list. Node *walker = head; int count 0 while(walker!-NULL&&count 3) if (walker->key10) count count +1; walkerwalker->next cout key data !# val) prevpres; pres pres->next prev->next-pres->next; return 1; What's wrong with the function? (select all that apply) Select one or more: a. function doesn't free the space of the node to delete after adjusting prev->next pointer b. function doesn't check edge case when head is NULL c. nothing wrong d. will have problems when head node is the expected node to delete Write a C++ function to find the minimum value in a linked list of positive numbers. The function takes one argument -the head of the linked list. The function should traverse through the linked list, find the minimum value and then return the minimum value. int LinkedListFindMinimum(node *head); The linked list structure: struct node int key: node *next; The following code will run to display the output int output LinkedListFindMinimum(head); cout 9 3 Result Answer: (penalty regime: 05.10.15, %) Write a C++ function to reverse a linked list. Input sequence will form a linked list. The function takes one argument: the head of the linked list. The function should return the head of the reversed list. node* reverse(node whead); The linked list structure is already defined as follows: struct node int key; node next; ti For example: Test Result 1 2 3 456 6 5 4321 Answer: (penalty regime: 05.10.15, %) What is the order in which elements come off a stack? Select all that apply. Select one or more: a. first-in first-out(FIFO) b. last-in last-out(LILo) c. first-in last-out(FILO) d. last-in first-out(LIFO) Assume we have a stack named s. What will be the values stored in s after the following operations(from bottom to top)? s.push(1); s.push(5); s.push(6) s.pop: s.push(3) s.push(4) s.push(8); s.pop s.pop: Select one: a. 1,5,3 b. 3,4,8 . d. 5,6,8

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

Students also viewed these Databases questions