[solved]-Question 4 6 Points Purpose Practice Analyzing Algorithms Assess Run Time Complexity Degre Q39052302
PYTHON 3 Analyzing run time complexity

Question 4 (6 points): Purpose: To practice analyzing algorithms to assess their run time complexity Degree of Difficulty: Easy Phoenix Wright, ace attorney, hasjust setup a new computer filing system to keep track of his court cases. He had his friend Larry Butz write the code (below) for the filing system. Larry claims his code is super fast, and runs in O(1) time. Is this statement at all correct? What about in the worst CASE? Best CASE? (no need for average case). JUSTICE-ify your answer. Carefully read the evaluation criteria of the question. def file case (case, 1 closed cases ) : 3 Purpose 4 Checks whether the given case has been closed, 5 and if so puts it into the closed_cases. 6 If the case has not yet been closed, a search 7 to return any previously closed and related cases. is done 8 Pre: a dictionary containing 3 fields status a string. Either “Open” or Closed” keywords = list of strings. May match tags of other Can be any arbitrary length case: 10 11 cases. 12 13 crime string. What the single alleged crime “burglary “, is 14 E.g. murder”, closed_cases: list of cases (see case Post case is appended to closed_cases is etc 15 above) 16 if the status 17 of case is “Closed 18 Closed”, Return Empty list if case ‘s status наs 19 otherwise a list of related cases 20 if case “status” 21 Closed”: 22 # Case is closed. Just add it to our list of closed cases closed cases.append (case) 23 24 return 25 Case is not closed, do a search to return any related closed cases 26 related_cas es = for search_term in case “keywords”] for closed case in closed_cases 27 28 == closed case [“crime”]: related_cases.append (closed_case) 29 if search_term 30 31 return related cases What to hand in Include your answer in the a7.txt document. Clearly identify your work using the question number Evaluation 2 marks: You correctly identified the best and worst case in Big-O, and whether Larry sucks. 2 mark You identified any size input size parameters. 2 marks: Your JUSTICE-ifications and analysis are correct (accusing people and OBJECTIONS! are encouraged) Page 6 Show transcribed image text Question 4 (6 points): Purpose: To practice analyzing algorithms to assess their run time complexity Degree of Difficulty: Easy Phoenix Wright, ace attorney, hasjust setup a new computer filing system to keep track of his court cases. He had his friend Larry Butz write the code (below) for the filing system. Larry claims his code is super fast, and runs in O(1) time. Is this statement at all correct? What about in the worst CASE? Best CASE? (no need for average case). JUSTICE-ify your answer. Carefully read the evaluation criteria of the question. def file case (case, 1 closed cases ) : 3 Purpose 4 Checks whether the given case has been closed, 5 and if so puts it into the closed_cases. 6 If the case has not yet been closed, a search 7 to return any previously closed and related cases. is done 8 Pre: a dictionary containing 3 fields status a string. Either “Open” or Closed” keywords = list of strings. May match tags of other Can be any arbitrary length case: 10 11 cases. 12 13 crime string. What the single alleged crime “burglary “, is 14 E.g. murder”, closed_cases: list of cases (see case Post case is appended to closed_cases is etc 15 above) 16 if the status 17 of case is “Closed 18 Closed”, Return Empty list if case ‘s status наs 19 otherwise a list of related cases 20 if case “status” 21 Closed”: 22 # Case is closed. Just add it to our list of closed cases closed cases.append (case) 23 24 return 25 Case is not closed, do a search to return any related closed cases 26 related_cas es = for search_term in case “keywords”] for closed case in closed_cases 27 28 == closed case [“crime”]: related_cases.append (closed_case) 29 if search_term 30 31 return related cases What to hand in Include your answer in the a7.txt document. Clearly identify your work using the question number Evaluation 2 marks: You correctly identified the best and worst case in Big-O, and whether Larry sucks. 2 mark You identified any size input size parameters. 2 marks: Your JUSTICE-ifications and analysis are correct (accusing people and OBJECTIONS! are encouraged) Page 6
Expert Answer
Answer to Question 4 (6 points): Purpose: To practice analyzing algorithms to assess their run time complexity Degree of Difficult… . . .
OR

