Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 . [ 3 0 points ] Implement the function has _ duplicates _ word _ finder ( ) . Input will be given a

1.[30 points] Implement the function has_duplicates_word_finder(). Input will be given a
positive integer n, then a list contains n elements that each containing a string. Output should
be either 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. For example, input 5[spring, summer, fall,
summer, winter] will return True; input 4[spring, summer, fall, winter] will return False.
(Hint: (1) You need to program an users input on the integer and the words (2)You might
use set in python.)
2.[40 points] Implement the function sort_flowers(). Input will be given a positive integer n,
then a list contains n elements that 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. For example, input 3[Rose, Lily, Tulip] will
return [Lily, Rose, Tulip].
3.[30 points] In this problem, your task is to complete the reverse_list() function. You will
write a function to reverse a list of integers. Your algorithm must 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 input as a list of integers and output another list 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].PY[30 points] Implement the function has_duplicates_word_finder(). Input will be given a
positive integer n, then a list contains n elements that each containing a string. Output should
be either 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. For example, input "5[spring, summer, fall,
summer, winter]" will return True; input "4[spring, summer, fall, winter]" will return False.
(Hint: (1) You need to program an user's input on the integer and the words (2)You might
use set in python.)
[40 points] Implement the function sort flowers(). Input will be given a positive integer n,
then a list contains n elements that 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. For example, input "3[Rose, Lily, Tulip]" will
return "[Lily, Rose, Tulip]".
image text in transcribed

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

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions