Linked list (C++)
CSCI 15, Lab Assignment 8 Due 11/28/2018, 15 Points Linked List A data structure is a software "construct" that allows data to be stored, retrieved and accessed in a particular manner. Individually stored data is called a "node". Capabilities include: . Adding new data elements either in front or back of the data structure . Changing values in existing nodes . Finding a particular node based on a value Display the contents of the data structure (front to back or back to front) A linked list allows an "'unlimited" number of nodes using pointers (this is NOT an array nor is it a vector). 1. 2. Store an integer value in the nodes Add a node (allow user to add a node either in front or append in back of the linked list, we will keep this "simple"). Since we are using pointers, the list can be potentially "unlimited" in size and number of nodes Display the value (front to back AND back to front) 3. You might wish to present the user interface as a "menu" with one option as "Quir" (end this application). Allow user to run this as many times as they wish. You have got to keep track in the node of several data items as well as in the application: Pointer to the previous node location of this list in memory (first node in list has nothing in front hence NULL) Data Element (integer in this case, but can this be expanded?) Pointer to the next node location of this list in memory (last node in list has nothing in back hence NULL) Since the node has to keep track of several data items, it would have to be a "struet" The pointers would have to be of that user defined "data type" Keep track of the number of nodes (every time you add a node) Keep track in memory of where the First Node and Last Node memory locations The command "new" creates a new memory location (ie, p-new Numbers) . . . · Add a Node to the front: 1. If there are NO nodes in the list: a. Create a new node b. Set the First to its memory location c. Set its Previous and Next to NULL d. Set the value for the data element e. Set a memory pointer to keep track of where it is (i.e. the First node and the Last node) You might want to keep track of how many nodes you have (ie, every time you add a node) E
7 years ago
0.05
Purchase the answer to view it

- SCI 207 Week 5 LAB Pollution Information
- A+ Paper
- disscussion reply to the question asked from students minimum words count 50 to 75each
- i have definition paper essay have to be handle tomorrow its only 850 words???
- sociology
- SOCIOLOGY 2
- mass media
- what is the answer to 2x -2 = x + 4
- quiz i need it in 1 hour plz help me now
- qnt 275 statistics my math lab week 3 problem set qnt 275 statistics my math lab week 3 problem set 6 my math lab problems for statistics Attachments: page_1.jpg page_2.jpg page_3.jpg page_4.jpg page_5.jpg page_6.jpg page_7.jpg