Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 Figure B3 shows 3 nodes arranged as a single linked list, together with 5 pointer variables (pPrev, pNext, pHead, prail and pCur). Answer

image text in transcribedimage text in transcribed

Question 1 Figure B3 shows 3 nodes arranged as a single linked list, together with 5 pointer variables (pPrev, pNext, pHead, prail and pCur). Answer all the questions (a-f). Do not define any new variables, use only the variables defined in Figure B3. Each question is independent/ not related of each other. pPrev pNext BBB next FFF next HHH next NULL NULL pCur pHead pTail Figure B3: Single link list with 3 nodes Answer each question (a-c) below by redrawing the Figure B3 after execution of the code statements. a. Redraw the result to Figure B3, after the following statements execute. (2.5 marks) pPrev = NULL; pCur = pHead; pNext pCur->next; pTail = pNext->next; pHead = pCur->next; b. Redraw the result to Figure B3, after the following statements execute. (3 marks) pCurr = prail; pTail = prail->next; pPrev = pHead->next; pPrev->next = NULL; pHead->next = pCur; c. Redraw the result to Figure B3, after the following statements executes (2.5 marks) pPrev - pNext pHead; while (pNext != NULL) { pCur = pNext; pNext = pNext->next; }//endwhile d. Given a new node, NNodel shown below, write a C++ code segment to insert NNodel in between node#2 (FFF) and node#3 (HHH) in Figure B3. (3 marks) NNodel GGG next NULL e. Given a new node, NNo de 2 shown below, write a C++ code segment to insert NNode2 before node#1(BBB) in Figure B3. (2 marks) NNode2 next NULL f Write a C++ code segment to delete node#2 (FFF), and connect node#1 (BBB) and node#3 (HHH) in Figure B3. (2 marks)

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

Beginning VB.NET Databases

Authors: Thearon Willis

1st Edition

1594864217, 978-1594864216

More Books

Students also viewed these Databases questions