Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / Code in java file that contains the entire programReadFileThe number of items in the file is unknown

Code in java file that contains the entire programReadFileThe number of items in the file is unknown

Computer Science

Code in java file that contains the entire programReadFileThe number of items in the file is unknown.SplitMerge

Create linked list from an input file (input.txt) that contains an even number of first names.

Create 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 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 .java file.

 

 

From within main call

 

ReadFile (Read the contents of file, create 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)

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE