Terminate the linked list properly

Assignment Help Data Structure & Algorithms
Reference no: EM13317365

Cr-z-a.te a program that uses a linked list to keep track of the US Presidents.

We have a data the which contains the last name, followed by "other" names ()leach US President, in order. along with the date each took office and the date each left office. By "other" names is meant first or first plus middleks).

Define a struct which has exactly 5 variables that, for one person, will hold the last name, the "other" names. the-year-took-office. the-yew-left-office, and a pointer. The pointer will be used to point to the next set of data. for the next person.

_Arrange r our links so that you have first George Washington, then John Adams. then Thomas Jefferson,etc.

Make sure you terminate the linked list properly.

In your program. read all this data from the file (use a loop) and store it in a linked list. The pointer stored with each President should point to the next President's struct variable.

Then have your program print out these words "The United States Presidents, and the number of years they held office." Move the cursor down to the next line.

Then use the linked-list pointers to step through the list (using a loop) and print out the "other" names (containing whatever spaces they had originally) followed by a space followed by the last name of each person and after the person's name the number of years they were in office (this is a value calculated in your program). So the output has one President per line. Use setw() so that the number-of-years-in¬office are all lined up in a column, right-aligned. For the one still in office print after the name, "Currently in office."

Look at the data file before you start to plan your program. You may test specifically for Van Buren, the only president with a space in his last name, but otherwise do not tailor your program for specific data entries. Make the program general to handle all the data. Do not make any changes in the data tile.

Reference no: EM13317365

Questions Cloud

What is the frequency of this system : The maximum speed of a 4 kg mass attached to a spring is 0.68 m/s, and the maximum force exerted on the mass is 12 N. What is the frequency of this system
Calculate the pressure in the constriction in a pipe : When 0.3 m^3/s water flows through a 150 mm constriction in a 300 mm horizontal pipeline, the pressure at a point in the pipe is 345 kPa, and the head loss between this point and the constriction is 3 m.
When the fire truck is at rest : A fire truck siren produces a steady single tone of frequency 500 Hz when at rest. When the fire truck is at rest
Determine flow rate into or out of each reservoir : Three reservoirs are connected by three pipes with hA = 100 f t, hB = 20 f t, hC = 0 f t, l1 = 1000 f t, l2 = 500 f t, l3 = 400 f t and D1 = D2 = D3 = 1 f t. Determine flow rate into or out of each reservoir if friction in each pipe is 0.02.
Terminate the linked list properly : Define a struct which has exactly 5 variables that, for one person, will hold the last name, the "other" names. the-year-took-office. the-yew-left-office, and a pointer. The pointer will be used to point to the next set of data. for the next perso..
Determine the reaction of the rocker b on the beam : Determine the horizontal and vertical components of reaction at the pin A and the reaction of the rocker B on the beam. a)Determine the horizontal and vertical components of reaction at the pin A
What is the orbital speed of the second satellite : A satellite is in a circular orbit around an unknown planet. The satellite has a speed of 1.70 104 m/s, and the radius of the orbit is5.00 106 m. What is the orbital speed of the second satellite
List the things you changed and the purpose of changing it : For readability, all variable names were changed to start with a lowercase letter (e.g. VerbList was changed to verbList) and all function names were changed to start with a uppercase letters
Corporate goals-objectives for coping with unionization : Which of the following is required by most unions and is often waived for workers who become members following a successful organizing drive? Many employers have corporate goals and objectives for coping with unionization and

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Creating decision tree

Premium Airlines has currently offered to settle claims for a class action suit, which was originated for alleged price fixing of tickets. The settlement is stated as follows. Create a decision tree for this condition.

  Design algorithm to solve spectral assembly problem

Design an algorithm to solve the Spectral Assembly problem under the above conditions. Does the problem have a unique solution?

  Create tree correspond to expression pre-order traversal

Let the algebraic expression E=(2x+y)(5a-b)^3. Create tree T which correspond to expression E and determine pre-order traversal of T.

  Design an o(v+e) time algorithm that computes

Design an O(V+E) time algorithm that computes the smallest number of batches required to complete all tasks. A task can be assigned to a batch i if and only if all tasks that are its prerequisites have already been assigned to batches 1 to (i-1).

  Finding the values of queuefront and queuerear

Assume that queue is a queue type object and the size of the array-implementing queue is 100. Also, assume that the value of the queueFront is 25 and the value of queueRear is twenty-five.

  Complications in a time sharing system

Determine what complications could happen in a time-sharing system if two processes need access to the same file at the same time?

  Write schedule produced by earliest deadline first algorithm

Given below are two sets of real-time, periodic tasks. For (a), will the schedule produced by Earliest Deadline First algorithm meet all the deadlines?

  Powerpoint presentation with the focus on stress management

Assume you have been asked to help new students identify ways in which they can manage their time so that they can be successful in an online learning environment.

  Design algorithm based on bfs that colors a graph

Design an algorithm based on BFS that either colors a graph with 2 colors or determines that two colors are not sufficient.

  Write a flowchart to solve any linear equation ax+b=01.

Write a flowchart to solve any linear equation ax+b=01. W Write a flowchart to solve any linear equation ax^2+bx+C=0

  How many leaf nodes can a decision tree have

At most how many leaf nodes can a decision tree have if it is consistent with a training set containing 100 examples?

  Find out the big-o running time of bubble sort

Find out the big-O running time (tight bound) of bubble sort. Illustrtae your derivation. Count comparisons as critical operation.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd