This preview shows pages 1–3. Sign up to view the full content.

CIS 15BG Answers Chapter 15 LINKED LISTS 1. Imagine we have a linked list as shown below. What would happen if we apply the following statements to the list? Draw "the answer". Note that each statement does not affect the other statements and it is only based upon the original assumptions: Assume : p->data = 10; q->data = 20; r->data = 15; and that p points to the first node in the list, q to the second, r to the third, and t to the last one. (A). p = p->link; (B). q = p; (C). r = p->link; (D). q->data = r->data; (E). p->data = q->link->data; (F). t->link = p; 2. A NODE in a linked list has two fields: part , a structure of type PART, and next , a pointer to the next node. The PART structure has three fields: code , an integer, name , a 1 p q r p q r p q r 10 15 15 p q r p q r p q r t t t t t t 10 20 15 10 20 15 10 20 15 15 20 15 10 20 15

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
CIS 15BG Answers Chapter 15 LINKED LISTS dynamically allocated string, and an array of 10 suppliers' codes (also integers) named sAry . (A). Write the definition for the NODE and PART structures.
This is the end of the preview. Sign up to access the rest of the document.