Question
Using C++ Suppose a program has to maintain a list of flights departing in the next few hours, and we have decided to implement it
Using C++
Suppose a program has to maintain a list of flights departing in the next few hours, and we have decided to implement it as a doubly linked list. A node of the list can be represented as:
struct NODE { FLIGHT flight; NODE *next; NODE *previous; }; struct FLIGHT { int flightNum; string destination; };
Create a doubly linked list to hold the initial flight information:
Houston, Chicago, Arizona, Baltimore, Detroit, Denver, Houston
Your program must implement the following methods: Append, Prepend, Remove, InsertAfter, and Print
The Append function, appends data to the end of the list
The Prepend function, prepends data to the beginning of the list
The Remove function, removes a node from the list and adjusts the length of the list
The Print function must print the entire list
Prepend Dallas to the list
Remove Arizona from the list
Append Kansas City to the list
Insert Minneapolis after Kansas City in the list
Remove Houston from the list
Print the flight record using the Example of how your output is supposed to look:
Example:
Flight Records for HowardAir Flight CSCI0136:
Dallas to Houston
Houston to Chicago
Chicago to Baltimore
Baltimore to Detroit
Detroit to Denver
Denver to Kansas City
Kansas City to Minneapolis
Minneapolis to Dallas
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started