I hadn't been here for fifteen years
java.math.BigDecimal for an infinite (or OutOfMemoryError) representation.
Tushar Goel wrote:
java.math.BigDecimal for an infinite (or OutOfMemoryError) representation.
Even BigDecimal can't represent anything infinitely.
I hadn't been here for fifteen years
Conrado Sanchez wrote:Is the Big O expression to the code below equal to O(number of digits in the number n)??? If so, how???
I hadn't been here for fifteen years
Stephan van Hulst wrote:Wow, what confusion. I'm not quite sure how BigDecimal fits into this question.
I hadn't been here for fifteen years
Even Bogosort will finish in a finite time. I think it runs in P(n!) however. The number of attempts depends on the factorial of the number of cards.Stephan van Hulst wrote: . . . For instance, sorting a deck of cards by throwing all cards in the air, and picking them up and hoping that they're sorted, has a best case running time in O(1), if you get it done on the first try. However, you may never finish, so it has a worst case running time in O(∞).
I hadn't been here for fifteen years
Campbell Ritchie wrote:Even Bogosort will finish in a finite time. I think it runs in P(n!) however. The number of attempts depends on the factorial of the number of cards.
A.J. Côté wrote:Quiz question for Stephan and the O notation experts in here:
What is the O notation for the OP function if BigDecimal were used, pretending you have infinite memory to store the BigDecimal?
In other words, what is the O notation for a function that will never return as n tends to zero?
Thanks in advance,
Stephan van Hulst wrote:
This is a contrived example, but you already answered it. If the function never returns, it's in O(∞).
I hadn't been here for fifteen years
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
Stephan van Hulst wrote:Big O notation is not an indication of worst running time. It's an indication of the upper bound...
"Leadership is nature's way of removing morons from the productive flow"  Dogbert
Articles by Winston can be found here
You have to be odd to be #1  Seuss. An odd little ad:
Thread Boost feature
https://coderanch.com/t/674455/ThreadBoostfeature
