subject

Imagine we have a list of instances of OnlineOrder, called orders. There are various functions and algorithms we could run on it. Here's one such algorithm. This algorithm retrieves the total cost of the first order in the list. Note that if relevant, you may assume that all orde in orders have around the same number of items.
1 det et first order total orders
What is the running time of this algorithm in terms of Big O notation?
O(1) constant order O(n)
linear order (nº)
quadratic order (12)
polynomial (cubic, specifically) order
O(2) exponential order O(log(n))
logarithmic order
Imagine we have a list of instances of OnlineOrder, called orders. There are various functions and algorithms we could run on it.
Here's one such algorithm. This algorithm finds the total cost of orders in the list. Note that if relevant, you may assume that all or have around the same number of items.
1 def get all order totals(orders):
2 total = 0.0
3 for order in orders:
4 total + order. get order total) Si
5 return total
What is the running time of this algorithm in terms of Big O notation?
O(1), constant order (n)
linear order (n2)
quadratic order (nº)
polynomial (cubic, specifically) order 0
O(2), exponential order (log (n))
logarithmic order 0.0/1.0 point
Imagine we have a list of instances of OnlineOrder, called orders. There are various functions and algorithms we could run on it.
Here's one such algorithm. This algorithm searches for an order with a giverr order number, and returns the index of where it is found. If it is found, it returns - 1. This is implemented with binary search, and we assume that orders is sorted from lowest order number to highest. Note if relevant, you may assume that all orders in orders have around the same number of items.
1) def search orders (orders, search number);
2) win = 0
3) nas n lentorders) 1
4) while in <-
5) current_middle (winna) // 2
6) If orders (current middlel on search numbers
7) return current middle
8) elif search number orders current siddle. order Numbers -
9) Max current siddle 1
10) else:
11) min = current middle an
12) return -1
What is the running time of this algorithm in terms of Big O notation?
O(1), constant order O(n)
linear order O(nº)
quadratic order On
polynomial (cubic, specifically) order 0
O(2), exponential order (log(n))
logarithmic order

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 16:00
You have inserted new slides based on a word outline. how do you format these new slides to match the powerpoint presentation formatting? a. select all slides in the presentation and click format on the home tab. b. select the new slides and click reset on the home tab. c. select all slides in the presentation and click reset on the home tab. d. select the new slides and click format on the home tab.
Answers: 3
question
Computers and Technology, 23.06.2019 02:30
Which component acts as a platform on which application software runs
Answers: 2
question
Computers and Technology, 23.06.2019 21:30
Which of the following includes the three primary network access technologies? dsl, cable modem, broadband lan, wan, man voip, uc, iptv tcp/ip, ftp, dhcp
Answers: 2
question
Computers and Technology, 24.06.2019 00:40
To maintain clarity and focus lighting might be needed
Answers: 2
You know the right answer?
Imagine we have a list of instances of OnlineOrder, called orders. There are various functions and a...
Questions
question
History, 18.05.2021 03:30
question
Advanced Placement (AP), 18.05.2021 03:30
question
English, 18.05.2021 03:30
question
Biology, 18.05.2021 03:30
Questions on the website: 13722361