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

Info icon This 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
Image of page 1

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

View Full Document Right 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
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)
Image of page 3

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

View Full Document Right Arrow Icon
i 1 0 //Insert 1 at end List End Occupancy 1 pre next data 1 xxx List, in order: 1
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
Image of page 5

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

View Full Document Right 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 data
Image of page 6
Image of page 7

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

View Full Document Right Arrow Icon
Image of page 8
Image of page 9

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

View Full Document Right Arrow Icon
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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern