Question: Please do provide the functions and few sentences for explanations for part 1. Also in part 2. thank you very much to you Part 1





Please do provide the functions and few sentences for explanations for part 1. Also in part 2. thank you very much to you
Part 1 For the following snippets of code perform the following Find the function for the number of steps the algorithm performs. To what Big-O set will this algorithm belong to (i.e. What is the complexity of this algorithm.)? Since n usually refers to input size you may assume it is a positive integer. Problem 1 Edef nested (n): for i in range (n): for i in range (n): print (n) print(n) print(n) Problem 2 def looping (n): m = n m = m*10 for i in range (m/2): print (n) Problem 3 Edef nothing (n): for i in range(n): if n==n: break print (n) Problem 4 def repeatingloops (n): for i in range(n): print (n) for i in range (n): print (n) for i in range (n) : print (n) Problem 5 def loopingloops (n): for i in range (n): for j in range (10): print (n) Problem 6 def dividing (n): while n!= 1: n = math.floor (n/2) return True Part 2 Problem 7 Show that a function y = n^2 can not belong to the set (1) using the formal definition of Big-o
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
