3 3 3 3 def change_maker (my_coins, my_money): output = [] i = 0 j = len(my_coins) while i < j: div = my_money // my_coins[i] my_money (my_coins[i] * div) output.append(div) i += 1 return output def main(): | print(change_maker ([25, 10, 5, 1], 121))

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Hi, could you tell me the big O notation for this fuction please?

def change_maker(my_coins, my_money):
output = []
i = 0
j = Len(my_coins)
J
while i < j:
div = my_money // my_coins[i]
my_money -= (my_coins[i] * div)
output.append(div)
i += 1
return output
def main():
|
print(change_maker([25, 10, 5, 1], 121))
main()
Transcribed Image Text:def change_maker(my_coins, my_money): output = [] i = 0 j = Len(my_coins) J while i < j: div = my_money // my_coins[i] my_money -= (my_coins[i] * div) output.append(div) i += 1 return output def main(): | print(change_maker([25, 10, 5, 1], 121)) main()
Expert Solution
Step 1

Introduction

Big O notation:

Big O notation is a mathematical notation used to describe the upper bound of the growth rate of the running time of an algorithm, with respect to the size of the input. It is a way to describe the efficiency of an algorithm by giving an estimate of the maximum number of operations it takes to solve a problem.

Big O notation provides a high-level view of the performance of an algorithm, independent of the specific details of the computer architecture and programming language used to implement the algorithm. This allows for easy comparison of the performance of different algorithms and helps to identify the most efficient solution for a given problem.

The most commonly used big O notations are O(1), O(log n), O(n), O(n log n), O(n^2), and O(2^n), where n is the size of the input. These notations describe the upper bound of the running time of an algorithm, from the fastest (O(1)) to the slowest (O(2^n)).

 

 

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Program on Numbers
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.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education