write the big O complexity of the two functions. show complete solution esp. in noting the runtime of the instructions in within the loop
write the big O complexity of the two functions. show complete solution esp. in noting the runtime of the instructions in within the loop
Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter19: Probabilistic Dynamic Programming
Section19.4: Further Examples Of Probabilistic Dynamic Programming Formulations
Problem 7P
Related questions
Question
write the big O complexity of the two functions. show complete solution esp. in noting the runtime of the instructions in within the loop
![def zim(a, b):
tmp = 1
for i in range(1, b+1):
if (a%i + b%i) == 0:
tmp = i
return tmp
def zam(a, b):
while b > 0:
a, b = b, a % b
return a](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fb9a34e2d-b1d8-460b-bff3-130df8077fd7%2F52a3f3f4-e7ca-4145-8cbe-1dbebc86b918%2Ftea6l4i_processed.png&w=3840&q=75)
Transcribed Image Text:def zim(a, b):
tmp = 1
for i in range(1, b+1):
if (a%i + b%i) == 0:
tmp = i
return tmp
def zam(a, b):
while b > 0:
a, b = b, a % b
return a
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
![Operations Research : Applications and Algorithms](https://www.bartleby.com/isbn_cover_images/9780534380588/9780534380588_smallCoverImage.gif)
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole
![Operations Research : Applications and Algorithms](https://www.bartleby.com/isbn_cover_images/9780534380588/9780534380588_smallCoverImage.gif)
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole