Given the code below and the comment analysis:
n = len(L) # O(1) for i in range(n): # O(n) - I read online that range(n) will take constant time but the 'for i in range(n)' part would make this O(n)? if L[i] > 0 : # O(1) for j in range(n): # O(n) answer = answer + L[i] # O(1) - since indexing takes constant time else : # O(1) for j in range(n): # O(n) answer = answer - L[i] # O(1)
My Overall Analysis:
- $ O(1)$ for the first variable assignment
- first if statement takes overall $ O(n)$
- else statement also takes overall $ O(n)$ => Overall if/else statements take $ O(n)$ as well
- for loop iterates n times => $ O(n * n)$ => $ O(n^2)$
=> Overall time complexity $ O(n)$
Thanks in advance for the suggestions!
EDIT: I am wondering if the
for i in range(n)
portion of the code takes O(n) or O(1)? I read that range(n) would take O(1) but since its a for loop it would take O(n)?
Hi Everyone, thank you in advance for your help. I tried to keep this request focused, but since I don't understand exactly what I'm asking for, I apologize for my rambling…
Right now, I manually update an HTML data on a website that changes cells in a table. Basically, I created a table to mimic a residential building so that each cell represents a property. When a particular property changes status (lists for sale, goes into Escrow, sells), I manually update the corresponding cell…
Need help understanding what I'm asking for…
Selling Limited Quantity of Dedicated Servers 99$+ 16 Cores | 32 Threads 2.6 GHZ | 48 GB RAM + | SSD | Great for SEO & Bots | Convert into multiple VPSs
Selling Cheap Dedicated servers from 99$ per month!
Unlimited Bandwidth ( 20 TB included monthly. That’s more than enough for 99% of the users unless you have a big tube site.)
You’ll get Root Access . This is a Unmanaged Server. You’ll be the only person with access to its OS.
USA Datacenter with 1 GB network.
FREE IPKVM Included ( so you can fully control your server and OS)
Setup fee is not lost. You’ll use the server for another month after you’ll stop paying. The setup fee is there so we won’t have to take immediate action if you don’t plan on paying another month.
Do not use them for anything illegal or offensive.
An active subscription is required to maintain access to your Server. I will remove your access within 1 month (setup month) and 48 hours of your subscription being cancelled.
Bulk discounts are available. If you start with 1 server and later you’ll buy a few more , contact us and we’ll adjust your invoice with the new bulk pricing.
No vouche copies are available. We’ve been selling dedicated servers among our private customers for a while now and just decided to open the service to the public.
If the Server isn’t suitable for whatever you need request a full refund within 3 days of ordering! (For packs up to 101 proxies.)[/COLOR]
Try it risk free with our 3 days money back guarantee!
Pricing! Monthly Payments!
Intel E5-2670 2.60 GHZ 16 Cores / 32 Threads 48 GB DDR3 / 480GB SSD = 99$
Intel E5-2670 2.60 GHZ 16 Cores / 32 Threads 64 GB DDR3 / 480GB SSD = 112$
Intel E5-2680 2.70 GHZ 16 Cores / 32 Threads 96 GB DDR3 / 480GB SSD = 140$
Intel E5-2680 2.70 GHZ 16 Cores / 32 Threads 128 GB DDR3 / 480GB SSD = 168$
2×1 TB HDD are provided free of charge on request on every variant ( for raid, storage, backup etc)
You can transform the server into multiple VPS! We can help you with that.
Ex : You could convert a server into 10 VPS easily
set them each with 8 core and 4.4 GB RAM (example with 48 GB variant). Set the most used ones on SSD, the rest on HDDs etc.
Pro Tip: Combine that with our Shared Proxy Pack ( you’ll get to use 1 Pack that’s limited on 1 IP on all the VPSs)
No other VPS provider can beat the Value / Price on such VPSs.
Payments via :
US Bank ACC
Do you want to pay via another method? Let me know maybe I can add it.
Limited quantity available! Get yours before the stock runs out!
Contact me via PM, on site at https://www.bywex.com/contact/ or via skype at
Is instagram good to generate traffic for loan and forex offers?…