Microsoft Word - Program_01.docx SCSU CSC212-03 Spring 2020 Programming Assignment 01: Algorithm Analysis Due Date: XXXXXXXXXXin-class at 6:15pm) In this programming assignment, you will need to solve...

1 answer below »
Help needed


Microsoft Word - Program_01.docx SCSU CSC212-03 Spring 2020 Programming Assignment 01: Algorithm Analysis Due Date: 03-09-2020 (in-class at 6:15pm) In this programming assignment, you will need to solve the following three problems: 1- Programming Exercise 1 Write a function that will have a list as an input, the task of the function is to check if all the elements in the list are unique,( i.e. no repetition of any value has occurred in the list), then the function returns true otherwise it returns false. Your program should include a main method that call the method to test it. 2- Algorithm Analysis For the function you implemented in part 1, please calculate T(n), which represents the running time of your algorithm in terms of n. Where n is the length of the list. Then find the order of magnitude of your algorithm (Big O). 3- Algorithms Comparison Please find another algorithm that solves part 1, write the code, calculate T(n) and find Big O. Then compare the efficiency with the algorithm from part1 to determine the more efficient one. Submission/Demonstration Instructions: This is an individual assignment that is due to the instruction as an electronic submission on the due date. Write the solution to part 1 in a .py file, part 2 in a .pdf file, and part 3 in a pdf file. Then zip the three files together into __CSC212_03_S20.zip and send it to the instructor by the due date- time. Failing to submit by the due date will result in zero credit for the entire assignment.
Answered Same DayMar 03, 2021

Answer To: Microsoft Word - Program_01.docx SCSU CSC212-03 Spring 2020 Programming Assignment 01: Algorithm...

Neha answered on Mar 07 2021
151 Votes
51532/Part 1.py
def checkIfDuplicates_1(listOfElems):
if len(listOfElems) == len(set(listOfEle
ms)):
return False
else:
return True
def main():
input_string = input("Enter family members separated by comma ")
listOfElems = input_string.split(",")
result = checkIfDuplicates_1(listOfElems)
print(result)
if __name__ == "__main__":
main()
51532/part 2.docx
Algorithm Analysis
For this program the following steps are followed.
· Ask user to provide input for the list in a set
· Compare the size of set and list.
· If the size of list and set is equal then it means that there are no duplicates.
· If the size of list and set are not equal then it says that there are duplicates.
As we have created a set from the list so it will give us a complexity of n(log (n)). Here n...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here