Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ please ReadFile Create a linked list from an input file (input.txt) that contains an even number of first names. The number of items in

C++ please

ReadFile

Create a linked list from an input file (input.txt) that contains an even number of first names. The number of items in the file is unknown.

SplitMerge

Create a split function that divides the newly created linked list into two equal sublists: myList1 and myList2. For example, originally you would point to (John, Jack, Jill, Jim). After the split, myList1 would point to john and jack and myList2 would point to jill and Jim.

Traverse

Accepts a pointer and displays each of the lists (myList1 and myList2 on the screen) Note: the traverse function takes only one argument, so the function would have to be called twice, once for each of the lists.

Merge

Feed the pointer variables myList1 and myList2 into the Merge function. Create a single list. Return the list.

Traverse

Pass in the pointer variable and display the returned list from the Merge function

Summary:

You need to write at least 5 functions: main, readFile, splitMerge, merge and traverse. The inputs will come from one input files (input.txt). There is no output file. The program should be in a single .cpp file.

From within main call

ReadFile (Read the contents of file, create a linked list and return the list to main)

SplitAndMerge (pass list, splits into list 1 and list 2, void return)

From within splitMerge

call Traverse (Display contents of list1)

call Traverse (Display contents of list2)

call Merge (Pass list1 and list2, merge and return one list)

call Traverse (Display contents of list coming back from Merge)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Technology And Management Computers And Information Processing Systems For Business

Authors: Robert C. Goldstein

1st Edition

0471887374, 978-0471887379

More Books

Students also viewed these Databases questions

Question

What are the benefits of planning for growth?

Answered: 1 week ago

Question

What are the factors affecting organisation structure?

Answered: 1 week ago

Question

What are the features of Management?

Answered: 1 week ago

Question

Briefly explain the advantages of 'Management by Objectives'

Answered: 1 week ago