Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Could you please help me with solving the problem following the instructions. This is in Python thanks. 1. Find the worst case running time in

Could you please help me with solving the problem following the instructions. This is in Python thanks.

image text in transcribed

image text in transcribed

image text in transcribed

1. Find the worst case running time in terms of the input n, using Big Oh notation, for each of the algorithms below. Briefly explain your answers. For function A, n is the input number; for B, n is the length of the input list, and for C, n is the length of the input strings, which you can assume are the same length. (a) def function(n): total = 0 for i in range(n): for j in range (2*n+3): for k in range(n // 2): total = total +1 return total (b) def functionB(inputlist): outputlist - n = len (inputlist) while len(inputlist) > n//3: outputlist.append(inputlist.pop(0)) return outputlist (c) def function(word, word2): listi = list (word) list2 = list (word) for item in liati: if item in list2: list2.remove(item) else: return false return True

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

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

More Books

Students also viewed these Databases questions