|
Real brainteaser (pg. 2)
|
View this Thread in Original format
| Flyboy217 |
| quote: | Originally posted by Tranc3
All you have to do is write a recursive stack function. |
LOL ;) |
|
|
| albertoR |
| quote: | Originally posted by DigiNut
Then don't post, because I don't think anyone here really gives a that some stranger on the internet is not going to try and solve a brain teaser. |
 |
|
|
| Tranc3 |
| quote: | Originally posted by Flyboy217
LOL ;) |
Well hey I'm just saying, if you know a recursive language like LISP you could probably write the function to find the solution with less than 10 lines of code. |
|
|
| Flyboy217 |
| quote: | Originally posted by Tranc3
Well hey I'm just saying, if you know a recursive language like LISP you could probably write the function to find the solution with less than 10 lines of code. |
Ah, gotcha. Yeah I thought you were trying to make a pun with the "stack" thing (you know, stacking disks...). Since all recursive functions implement stacks implicitly, I believe they are generally referred to as simply "recursive functions."
While it is true that you can write a small recursive computer program to solve it (that's how I did it, although it's closer to 100 lines), this is just a way of rephrasing the problem. Kind of like saying that you can solve Fermat's Last Theorem by "writing some Diophantine equations." It doesn't make it any easier!
Give it a go though. It's a nice problem :) |
|
|
| Vlad |
| I could do this if I was still taking C++ classes. I remember my teacher showing us how to write the Towers of Hanoi problem and ran it. It was pretty cool, I still have the C++ program, but I forgot most of the syntax. |
|
|
| Tranc3 |
| quote: | Originally posted by Flyboy217
Ah, gotcha. Yeah I thought you were trying to make a pun with the "stack" thing (you know, stacking disks...). Since all recursive functions implement stacks implicitly, I believe they are generally referred to as simply "recursive functions."
|
Haha no just trying to make myself sound smarter than I really am with big words and such.:p
Actually one of my teachers last year had us solve it. |
|
|
| Flyboy217 |
| quote: | Originally posted by Vlad
I could do this if I was still taking C++ classes. I remember my teacher showing us how to write the Towers of Hanoi problem and ran it. It was pretty cool, I still have the C++ program, but I forgot most of the syntax. |
Yeah, the original Towers of Hanoi is definitely a neat problem. I think you'll find that this is very different and a little more involved. It's kind of like the difference between "I wrote a program to play tic-tac-toe" and "I wrote a program to solve tic-tac-toe in N dimensions with M players from an arbitrary position" ;)
Okay so it's not THAT tough, but I think there's a reason why only 20 people in IBM Research (all of whom have PhDs in math and/or CS) solved it. |
|
|
| whiskers |
| quote: | Originally posted by Tranc3
Well hey I'm just saying, if you know a recursive language like LISP you could probably write the function to find the solution with less than 10 lines of code. |
but those 10 lines will take you 15 hours of coding to get to work
lisp is evil |
|
|
| Tranc3 |
| quote: | Originally posted by whiskers
but those 10 lines will take you 15 hours of coding to get to work
lisp is evil |
lol
Actually I kinda liked the recursive languages, once you get the hang of them you see why they're used for AIs and stuff. They're super efficient. |
|
|
| whiskers |
| quote: | Originally posted by Tranc3
lol
Actually I kinda liked the recursive languages, once you get the hang of them you see why they're used for AIs and stuff. They're super efficient. |
i kinda liked it too but NOT THE WAY OUR PROFESSOR TAUGHT US :nervous::nervous:
boy, am i glad that class is over... |
|
|
| Resnick |
| quote: | Originally posted by Flyboy217
Okay so it's not THAT tough, but I think there's a reason why only 20 people in IBM Research (all of whom have PhDs in math and/or CS) solved it. |
are you serious? the problem really doesnt seem tough at all, above avg yes, but only 20 ppl? how widely distrubuted is this problem? |
|
|
| whiskers |
| quote: | Originally posted by Resnick
are you serious? the problem really doesnt seem tough at all, above avg yes, but only 20 ppl? how widely distrubuted is this problem? |
i don't think the rest really gave a damn about it |
|
|
|
|