Question
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started