Question
Problem Specifications: Write a Java program that prompts the user to enter two lines of words. The words are separated by spaces. Extract the words
Problem Specifications:
Write a Java program that prompts the user to enter two lines of words. The words are separated by spaces. Extract the words from the two lines into two lists. Write the following methods that do the:
1- Display the union of the two lists in ascending alphabetical order using quick sort.
2- Display the difference of the two lists in descending alphabetical order using merge sort.
3- Display the intersection of the two lists in ascending alphabetical order using quick sort.
4- Recursively display the number of vowel letters in each list. The letters for vowels are A, E, I, O, and U.
5- Display a menu of six options: insert two lists, display the union, display the difference, display the intersection, display the vowel letters, and end program.
Find the time complexity of the above five methods. Write the Bio-O notation as a comment next to each method. Use ^ to represent the power sign (Example N3 = N^3)
Here is a sample of an output:
Line 1: red green blue yellow purple cyan orange
Line 2: red black brown cyan orange pink
The union is [black, blue, brown, cyan, cyan, green, orange, orange, pink, purple, red, red, yellow]
The difference is [blue, green, purple, yellow]
The intersection is [cyan, orange, red]
The number of vowels in the first line is: 13
The number of vowels in the second line is: 8
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