Hi Shilpa!
As every student could claim to not be one, we have no way of knowing if you are one or not. However, I'll give you a few tips that I would also feel comfortable giving you if you were a student.
The
big O notation (or Landau notation) only gives rough estimates. In general,
f in O(x) with
x being dependent on
n means that there's a real number
a so that f takes a maximum of
a*x steps. It doesn't matter if
a is 2 or 1000000, that's the same in big O notation. Oh, and you normally take the minimum
x for which this is true. So you could write
O(2n) and then
a may be 3, but you could just as well write
O(n) with
a=6, the latter being the generally used form.
A tip about the first example: Think about, how you would implement the calculation of n! through iteration and recursion. How many steps would it take with either approach?
Oh by the way, and I'm assuming you're talking about time efficiency, not space efficiency? The Big O notation works for both, but your answers suggest time and that is often the one you're more likely to talk about when learning about algorithms.
Greetings,
Nepomuk