Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

writing code for merge sort that does not use recursive calls to any functions. Instead, it just uses loops. Any program that can be done

writing code for merge sort that does not use recursive calls to any functions. Instead, it just uses loops. Any program that can be done with recursive calls to a method can also be done without any recursive calls and still be as efficient. It saves time and space by avoiding the overhead of repeated calls to methods. Read all the details carefully and follow them.

* First of all it has to be coded in Java and using NetBeans as IDE

1.Create new NetBeans project that is called MergeSort (case sensitive) and a main class with that same name will be created. Make sure when you create the project, the Create Main Class is checked in NetBeans and the package name is removed. i.e. mergesort.MergeSort should be changed to MergeSort before you click the Finish button.

2. The input for the program comes from a text file called input.txt and the output will be written to output.txt. Note that NetBeans requires that both those files be in the root directory of the project, namely the MergeSort folder and not the src folder or build folder that NetBeans creates.

3. The input.txt will contain several lines of numbers where each line will have integers separated by spaces as unsorted lists. Each line must be sorted separately by your algorithm. So the algorithm is called repeatedly (not recursively) for each line in the input.txt. Use Scanner inFile = new Scanner(new FileReader("input.txt"));.

4.The output.txt will have the same numbers sorted for each line and in the same order of lines as in the input file. Use PrintWriter outFile = new PrintWriter("output.txt");

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

Microsoft Visual Basic 2005 For Windows Mobile Web Office And Database Applications Comprehensive

Authors: Gary B. Shelly, Thomas J. Cashman, Corinne Hoisington

1st Edition

0619254823, 978-0619254827

Students also viewed these Databases questions

Question

Discuss the key ambient conditions and their effects on customers.

Answered: 1 week ago

Question

Understand the roles of signs, symbols, and artifacts.

Answered: 1 week ago