DrawList

DrawList - data 3 xxx List, in order: 3 1 2 Questions-If we...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
List In-Memory Drawing for List w/ End pointer Slapped together in 15 minuted by Dan Roach
Background image of page 1

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

View Full DocumentRight Arrow Icon
Given the following class skeletons, draw the List as it resides in memory after the specified operations: typedef struct Node { struct Node * pre; struct Node * next; void * data; } Node; typedef struct List { Node * end; long occupancy; } List; Commands: i 1 0 //Insert 1 at end i 2 0 //Insert 2 at end i 3 1 //Insert 3 at front
Background image of page 2
NOTE The fields specified are not identical to those found in your hw3. You will be required to include ANY AND ALL fields that are included in the basic class sketches that you are provided. Any fields not included in that class sketch are NOT required (eg, list_count in this example)
Background image of page 3

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

View Full DocumentRight Arrow Icon
i 1 0 //Insert 1 at end List End Occupancy 1 pre next data 1 xxx List, in order: 1
Background image of page 4
i 2 0 //Insert 2 at end List End Occupancy 2 pre next data xxx 1 pre next data 2 xxx Pointers that were changed are highlighted in red List, in order: 1 2
Background image of page 5

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

View Full DocumentRight Arrow Icon
i 3 1 //Insert 1 at front List End Occupancy 3 pre next data xxx 1 pre next data xxx 2 Pointers that were changed are highlighted in red pre next
Background image of page 6
Background image of page 7

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

View Full DocumentRight Arrow Icon
Background image of page 8
Background image of page 9

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

View Full DocumentRight Arrow Icon
Background image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: data 3 xxx List, in order: 3 1 2 Questions-If we wanted to delete the end node, which pointers would need to be changed? What would get returned from remove_List()?-What if we wanted to delete the node with the data whose value is 1? DELETE Node at END List End Occupancy 3 pre next data xxx 1 pre next data xxx 2 Pointers needing to be changed (5 total) are highlighted in red The pointer that is returned is highlighted in blue pre next data xxx 3 DELETE Node with data value 1 List End Occupancy 3 pre next data xxx 1 pre next data xxx 2 Pointers needing to be changed (4 total) are highlighted in red The pointer that is returned is highlighted in blue pre next data xxx 3 Other Things to Know Be comfortable with the algorithms for insert, remove, and lookup Be generally comfortable with the code for all major List/Node functions; you should be able to quickly sketch out code to perform any major operation at a specified location...
View Full Document

This note was uploaded on 04/13/2008 for the course CSE 12 taught by Professor Gary during the Spring '08 term at UCSD.

Page1 / 10

DrawList - data 3 xxx List, in order: 3 1 2 Questions-If we...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online