Awesome q2a theme
0 votes
79 views

What should be the answer?

in Algorithms by (34 points) | 79 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
Top Users 2020 Aug 10 - 16
  1. Arkaprava

    404 Points

  2. jayeshasawa001

    198 Points

  3. SarathBaswa

    126 Points

  4. Ashutosh777

    67 Points

  5. toxicdesire

    20 Points

  6. Nilabja Sarkar

    12 Points

  7. premu

    10 Points

  8. iarnav

    7 Points

  9. Jhumpa_Sarma

    6 Points

  10. Patel0967

    6 Points

Weekly Top User (excluding moderators) will get free access to GATE Overflow Test Series for GATE 2021
Welcome to GATE CSE Doubts, where you can ask questions and receive answers from other members of the community.
Top Users Aug 2020
  1. Arkaprava

    404 Points

  2. jayeshasawa001

    203 Points

  3. Mellophi

    156 Points

  4. Ashutosh777

    143 Points

  5. SarathBaswa

    126 Points

  6. anurag sharma

    49 Points

  7. toxicdesire

    20 Points

  8. shashankrustagi2021

    16 Points

  9. premu

    16 Points

  10. Kushagra गुप्ता

    15 Points

7,769 questions
1,977 answers
11,275 comments
95,111 users