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 11:00
Which law requires employers to provide safe working environments for their employees? a. civil rights act b. fair labor standards act c. occupational safety and health act d. wagner act
Answers: 1
question
Computers and Technology, 22.06.2019 15:30
To increase sales, robert sends out a newsletter to his customers each month, letting them know about new products and ways in which to use them. in order to protect his customers' privacy, he uses this field when addressing his e-mail. attach bcc forward to
Answers: 2
question
Computers and Technology, 22.06.2019 17:30
Ou listened to a song on your computer. did you use hardware or software?
Answers: 2
question
Computers and Technology, 23.06.2019 03:30
Ihave a singular monitor that is a tv for my computer. recently, i took apart my computer and put it back together. when i put in the hdmi cord and booted the computer to see if it worked, the computer turned on fine but the screen was blue with "hdmi no signal." i've tried everything that doesn't require buying spare parts, any answer is appreciated!
Answers: 1
You know the right answer?
Imagine we have a list of instances of OnlineOrder, called orders. There are various functions and a...
Questions
question
Mathematics, 12.01.2022 20:10
question
Mathematics, 12.01.2022 20:10
question
Mathematics, 12.01.2022 20:10
Questions on the website: 13722367