Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need the code for this Python problem: - Given a .txt file with 100 random words, write a Python program that creates an Array

I need the code for this Python problem:

- Given a .txt file with 100 random words, write a Python program that creates an Array of 100 String objects for each word from the text file. The program will read each word from the file and store them in the array. (Duplicate words are allowed.)

- Add a method that displays all strings in the array and use it to display the unsorted list.

- Add a method that will copy the original string array to a second array.

- Add a Merge Sort method to your program that also counts the total number of Comparisons and the total number of Swaps done.

-Use the copy method on the original array, then call the merge sort on the copy. Display both unsorted and sorted arrays with the display method. Remember, the merge sort method also needs to print out the total number of Comparisons and Swaps performed.

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_2

Step: 3

blur-text-image_3

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

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

3rd Edition

0128012757, 978-0128012758

More Books

Students also viewed these Databases questions

Question

How is Karen Slagles argument an example of confirmation bias?

Answered: 1 week ago

Question

assess the infl uence of national culture on the workplace

Answered: 1 week ago