-6

I have been asked to explaine about Big O notation and to calculate Big o Notation for an algorithm. I'm done with the defining part but I'm still wondering how I can calculate it. Can someone help me to calculate the Big O for the below given code?

new = int (input("enter number" ))
if new <= 10000:
    comm=new*2/100
    print (comm)
else :
    comm= new*5/100
    print (comm)
Modus Tollens
  • 5,083
  • 3
  • 38
  • 46
Spin 360
  • 1
  • 2
  • As for your problem, there are many hits on Google when you search for "How to calculate big o", e.g. https://justin.abrah.ms/computer-science/how-to-calculate-big-o.html. Did you do research on big o calculation? Where exactly are you stuck? – Modus Tollens May 12 '18 at 07:33
  • yes i did im kind of like confused on how all these calculation stuff works – Spin 360 May 12 '18 at 07:37
  • @ModusTollens thankyou for the link u sent me it somewhat cleared my doubts but it would be a great help if you can give me some instructions also – Spin 360 May 12 '18 at 07:41
  • thanks a lot man thanks a lot finally understood thanks for sending me that link – Spin 360 May 12 '18 at 08:05

1 Answers1

1

Since there is no loop, it is O(1).

Lars Gendner
  • 1,816
  • 2
  • 14
  • 24