Awesome q2a theme
0 votes
50 views

What should be the answer?

ago in Algorithms by (29 points) | 50 views
0
You don't assume anything, and follow standard C rules.

Even if empty loop, counters have to be incremented, values compared, etc - so just account for that and proceed.

I highly doubt Gate will contain platform/compiler-specific answers.

However, I really want to see the solution to this question from the test series.
0

Given solution 

0
This solution is wrong.
They have assumed the rest of the program magically runs in 0 time.
0
Empty body of the loop still counts for Time complexity, because the program will still have to do comparison + (in/dec)crement.

It doesn't make sense to get rid of this line entirely anyway since the loop could be used to introduce intended side-effects.
0
I also think that the solution is wrong.

Please log in or register to answer this question.

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
Welcome to GATE CSE Doubts, where you can ask questions and receive answers from other members of the community.
Top Users Jan 2020
  1. shashin

    1163 Points

  2. Vimal Patel

    306 Points

  3. Deepakk Poonia (Dee)

    305 Points

  4. Debapaul

    237 Points

  5. Satbir

    192 Points

  6. SuvasishDutta

    137 Points

  7. Pratyush Priyam Kuan

    118 Points

  8. tp21

    108 Points

  9. pranay562

    95 Points

  10. DukeThunders

    94 Points

Monthly Top User and those within 60% of his/her points will get a share of monthly revenue of GO subject to a minimum payout of Rs. 500. Current monthly budget for Top Users is Rs. 75.
2,983 questions
1,509 answers
8,930 comments
89,814 users