Page 1 of 1

Let's define a "dropoff word" as one that can lose any one of its letters, and the remaining letters still makes up a va

Posted: Wed Apr 27, 2022 3:30 pm
by answerhappygod
Let S Define A Dropoff Word As One That Can Lose Any One Of Its Letters And The Remaining Letters Still Makes Up A Va 1
Let S Define A Dropoff Word As One That Can Lose Any One Of Its Letters And The Remaining Letters Still Makes Up A Va 1 (161.43 KiB) Viewed 34 times
Let's define a "dropoff word" as one that can lose any one of its letters, and the remaining letters still makes up a valid word. This process repeats until there is only one letter left. If there is an invalid word along the way then it's not a dropoff word. Here are some examples: • clink → link →ink → in →i strippers stripers stripes tripes tries → ties → tis → is → i • manager → manger → mange → mane → man → an → a To do: • Describe in English (you can use pseudocode if you wish) how to determine if a word is a dropoff word using recursion. • Write a program that implements your recursive algorithm. The algorithm should not use any global variables. Use the word list and binary search routine from program #2 to determine if a sequence of characters is a valid word in English. Hint: You will need some code that can make a copy of the current string with a letter removed at a given index. • Loop through all 87337 words in the word list, testing each word with your recursive dropoff function, and find the longest word that is a dropoff word. If there is a tie you can pick one of the longest words. Modify the recursive algorithm so it prints out the dropoff words so you can determine the word sequence down to a single letter (the only one letter words are "i" and "a"). You can comment this out for other parts of the program if you don't want it to spam out a bunch of words. What is the dropoff sequence for the longest dropoff word? .