6.18 Lab: Doubly-Linked List (Insert & Display) PDF

Title 6.18 Lab: Doubly-Linked List (Insert & Display)
Course Data Abstraction and Structures
Institution De Anza College
Pages 6
File Size 169.2 KB
File Type PDF
Total Downloads 55
Total Views 136

Summary

This lab is on Doubly Linked list with Insert and Display function missing.

This program:

- Generates a sorted linked list (student name and grade point average). The names are mentioned in ascending order.
- Moves the list forward (A to Z)
- Reverses the order...


Description

6.18 Lab: Doubly-Linked List (Insert & Display) Class: CIS22C - Lab Assignment Lecture: 6.18 Date: 01/30/2021 Description: This lab is on Doubly Linked list with Insert and Display function missing. This program: Generates a sorted linked list (student name and grade point average). The names are mentioned in ascending order. Moves the list forward A to Z Reverses the order of the list Z to A Your mission is to complete the following three functions: insertNode() is the default constructor. displayListBack() is a method for returning to the displayList.

Sorted Circular Doubly-Linked List with Sentinel Node Download and review the following files (read code and all comments carefully): StudentList.h StudentList.cpp main.cpp

This program: Creates a sorted linked list (student name and gpa) . The list is sorted in ascending order by name.

Displays the list forwards(A to Z Displays the list backwards(Z to A Your task is to finish writing the following three functions: default constructor insertNode() displayListBack()

main.cpp #include #include "StudentList.h" using namespace std; void buildList(StudentList &); int main() { // Define a StudentList object StudentList list; buildList(list); // insert data into the list string answer; cout > answer; if (answer == "Y" || answer == "y") { Student s; cout s.gpa >> s.name; list.insertNode(s); } cout stu.gpa = -1; head->stu.name = ""; head->forw = head; /* Write your code here */ head->back = head; count = 0; } //************************************************** // display list forwards: shows the value // stored in each node of the linked list // pointed to by head. from A to Z //************************************************** void StudentList::displayListForw() const { ListNode *pCur; // To move through the list // Position pCur: skip the head of the list. pCur = head->forw; // While pCur points to a node, traverse the list.

while (pCur != head) { // Display the value in this node. cout stu.gpa...


Similar Free PDFs