Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need these answers please, thanks 1. [ 30 points] Implement the function hasDuplicates in the class to DuplicateWordFinder. Input will be given as a line

need these answers please, thanks
image text in transcribed
1. [ 30 points] Implement the function hasDuplicates in the class to DuplicateWordFinder. Input will be given as a line containing a positive integer n, followed by n rows, each containing a string. Output should be either the word true if there are any duplicates among these strings or false if there are not. Your code should work well on long lists of strings. (You might use java built-in method ".equals ()".) For example, input \{spring, summer, fall, summer, winter\} will return true; input \{spring. summer, fall, winter; will return false. 2. [40 points] Implement the function sortFlowers. Input will be given as a line containing a positive integer n, followed by n rows, each containing a flower name (string) which always starts with capital letter (e.g., "Rose", but not "rose"). The program should sort the flower names in Alphabetical order. In this exercise you can assume that the capital letters of flower names are all different. You can make your choice to use any one of sorting algorithm from bubble sort, selection sort or insertion sort. (You might use java built-in method ".charAt()".) For example, input { Rose, Lily, Tulip\} will return {Lily, Rose, Tulip }. 3. [ 30 points] In this problem, your task is to complete the reverseArray0 method. You will write a method to reverse an array of integers. Your algorithm should use O(1) space beyond the input (any algorithms that use space not in O(1) will receive half credit at most). You may not use any library functions in this question (any solutions that do will receive zero credit). Your program should accept as input an array of integers and output another array of integers that contains the original elements in reversed order. For example, the input {3,4,7, 6,1} should result in printing the output {1,6,7,4,3}

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

Beginning ASP.NET 4.5 Databases

Authors: Sandeep Chanda, Damien Foggon

3rd Edition

1430243805, 978-1430243809

More Books

Students also viewed these Databases questions