Do my homework. Times Infinity plus one.

Pages: 12
> The problem with so many disks is each time you add one, the time it takes to run is more or less doubled.
That's because your algorithm is bad, you used an O(2^n) approach.

The task was to find out the number of moves, not to say what moves to make.
There was no need to simulate it.

Instead, you could simply use the recurrence
T(0) = 0
T(K) = 1 + 2*T(K-1)

for O(n), or solve it for O(1)


I want to believe that your teacher reduced the limit so you don't have to deal with overflow issues.
Last edited on
lol, I was surprised that 43 disks did not overflow the unsigned long long int, I think that was just about at the limit though, and one more disk would have. 8,796,093,022,207 is the number I got. Overflow was another issue I brought up along with the time deal though, once I saw what was happening.

I probably should work on algorithms more, they are definitely a week link for me. I can see where that would be faster, I think, but I also included an option to show the moves, if you wanted, even though it was pointless with more than 8 disks because the print out was just too long.
> lol, I was surprised that 43 disks did not overflow the unsigned long long int
T(K) = 2^K - 1
Yea, but that is scientific notation, assuming I am remembering right.
Um... what? No, it's just 2^k - 1 for k number of disks. What's that got to do with scientific notation? One disk takes one move, two disks take 3 (one to two, one to three, two to three), and so on.
Scientific notation:
2.7854 * 108

And what Ispil probably meant is that unsigned long longs can store values between 0 and 264 - 1, so T(K) = 2K - 1 won't overflow it even with 64 (it will be just perfectly at the end of range).
Last edited on
I used that formula to make sure I was counting right. Instead of overflowing, the result was given in scientific notation. I think I only used an int though.
No, I was just confused as to what scientific notation had to do with anything. Thought he said that 2^k - 1 had something to do with scientific notation, which seemed silly. Alright, thanks for clarifying.
To be honest, I've noticed that plenty of people who ask for help in their assignments are just scared of digging in. 90% of my customers come to me asking for help in their assignments - and I do help them - but not the way they want.

I pretty much convince them to sit in front of their screen, and I just talk to them. I ask them questions, I rephrase the assignment instructions, in order to get them thinking. Then, they hit a point where they start coming up with solutions, but in an "asking" tone. They won't do it unless they detect a hint, or a confirmation from you.

Further in, and they are pretty much coding stuff themselves.

Not every student really agrees with this approach - thus an earlier post I had regarding the same topic :/ But still, I do know that there's quite a few programmers out there who just need a boost in confidence and someone to push them on - as crazy as that may sound.

Cheers!
To be honest, I've noticed that plenty of people who ask for help in their assignments are just scared of digging in. 90% of my customers come to me asking for help in their assignments - and I do help them - but not the way they want.


I disagree. Because we are talking about people who asks "Do my homework", not "I cant do it, help", or "How can i do".

I can assure you people who asks for doing their homework are immoral. They ask you to do it for them, not helping to get done what he/she made.

EDIT: By the way when i first saw the thread i said "fu..", and then i saw Duoas' name and said "WHAT THE FUUU..."
Last edited on
Topic archived. No new replies allowed.
Pages: 12