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

  A and b, both of which perform the same function

Assume you have two algorithms, A and B, both of which perform the same function,

  Analyzing the use of database in an organization

Examine the use of databases in your company. Include what database applications are used. Conclude through proposing improvements.

  Using a backtracking algorithm

If the backtracking algorithm finds a dead end, it retraces its path until it reaches a position from which there is an untried path. The backtracking algorithm always tries all directions from any position, and always in the same order.

  Java program to assign passengers seats in airplane

Prepare a Java program to assign passengers seats in an airplane. Suppose a small airplane with seats numbered as follows:

  Explaining use of encryption-virus and vpn

Write down the suitable example of best use of Encryption, Virus, VPN, Firewall securities, when and explain why?

  Dbms and data mining to imporve customer service

Discuss how a database management system and data mining can help motor vehicle maintenance center improve its services, and what tables would be required in such a database.

  Create binary tree based on names

The Binary Tree is one of best ways to organize information when you require fast access. For this project, we will organize a list of names and perform many operations on those names.

  Algorithm for partitioning a set of n weights into k

give a greedy algorithm for partitioning a set of n weights into k bins. b) does it find the perfect solution?

  Designing and populating a course table

Use data to design and populate a course table. Designate the CourseID field as a Primary Key and permit your database to automatically produce a value for this field.

  Creating sql statements

Create three SQL statements: the 1st statement should add pending amounts to appropriate accounts, the second statement should subtract the pending amounts from appropriate accounts,

  Conduct time complexity analysis of the algorithm

Conduct time complexity analysis of the algorithm and hand test your algorithm using your allocated 10-element long list of alphabetic characters as an illustrative/working example

  Enter the last names of five candidates

Write a program that allows the user to enter the last names of five candidates in a local election and the votes received by each candidate. The program should then ouput each candidate's name, votes received by that candidate.

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