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 5000+ random words, write a Python program that creates an Array

I need the code for this Python problem:

- Given a .txt file with 5000+ random words, write a Python program that creates an Array of 5000 String objects that will store each word from the text file. Your program will read in each word from the file, and store the first 5000 words values in the array. (Do not eliminate duplicate words.)

- Add a method that displays all Strings in the array, and use it to display the original (unsorted) list.

- Add a method to your program that will copy the original String array to a second array. Verify that this method works correctly by calling your display method to new the second array.

- Add an Insertion Sort method to your program. Call Insertion Sort to sort the words of the second array in alphabetical order. Your Insertion Sort method should count the number of comparisons executed to sort the array and the total number the array element swaps. Display both counts on the command line. Then call your display method to verify that the Insertion Sort method works correctly.

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

Oracle Database 11g SQL

Authors: Jason Price

1st Edition

0071498508, 978-0071498500

Students also viewed these Databases questions