Menu

Programming Language Java Introduction Seen Text Best Hope Sorting String Using Comparison Q43811902

Programming Language

Java

Introduction
As we have seen in the text, the best we can hope for when sortingstring using a comparison sort is O(n log n). In this chapter wesaw that Radix sort could sort numbers in O(n) time. What if wecould figure out a way to do a Radix sort on Strings? Thisassignment will challenge you to do just that. In order to makethis easier for you, the following assumptions will be made:

• No words will be longer than 10 characters (if there are morethan 10 characters, you can ignore them)

• You can convert all the words to lowercase
• Words will contain only letters, no special characters, spaces ornumbers

Assignment Description

The program will need to perform the following tasks:

  • Display your name and email address as the first output

  • Display the following under your name: I certify that this is myown work

  • Load a list of words from a file

  • Create 27 buckets (yes, I know there are only 26 letters in thealphabet…this may be a

    hint)
    o Each bucket will need to be a Collection object, please carefullyconsider which

    object you will choose and explain why you chose that one inyour comments

  • Process the words using the Radix sort algorithm from the bookas a guide, you will

    need to modify the algorithm to account for words of differinglengths

  • Display the result of each iteration of your Radix algorithm

  • Be careful when choosing your Collection objects, some don’tguarantee to maintain the

    order that items are added to them

Text File content

dogcactusplumantAPPLEcatDrumpumPkinburrowmanateewoodpeckerbookcase

Sample Run

Iterating on index: 9
dog cactus plum ant apple cat drum pumpkin burrow manatee bookcasewoodpecker

Iterating on index: 8
dog cactus plum ant apple cat drum pumpkin burrow manatee bookcasewoodpecker

Iterating on index: 7
dog cactus plum ant apple cat drum pumpkin burrow manatee bookcasewoodpecker

Iterating on index: 6
dog cactus plum ant apple cat drum burrow woodpecker manateepumpkin bookcase

Iterating on index: 5
dog plum ant apple cat drum bookcase woodpecker manatee pumpkincactus burrow

Iterating on index: 4
dog plum ant cat drum bookcase apple pumpkin burrow woodpeckermanatee cactus

Iterating on index: 3
dog ant cat manatee woodpecker bookcase apple plum drum pumpkinburrow cactus

Iterating on index: 2
cactus dog pumpkin manatee woodpecker bookcase apple burrow ant catplum drum

Iterating on index: 1
cactus manatee cat plum ant dog woodpecker bookcase apple drumpumpkin burrow

Iterating on index: 0
ant apple bookcase burrow cactus cat dog drum manatee plum pumpkinwoodpecker

Expert Answer


Answer to Programming Language Java Introduction As we have seen in the text, the best we can hope for when sorting string using a…

OR