How many times does the while loop gets executed if the following function is called as $f(120,13)?$
f(m,n) { ans := 1 while (m - n >= 0) { ans := ans * 2 m := m - n } return(ans) }
Making a tree diagram is easy to understand.
64.3k questions
77.9k answers
244k comments
80.0k users