Click here to Skip to main content
15,887,683 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralRe: Sith Interviewing Tactics Pin
Paulo Zemek7-Jul-09 7:27
mvaPaulo Zemek7-Jul-09 7:27 
GeneralRe: Sith Interviewing Tactics Pin
Dan Neely7-Jul-09 9:14
Dan Neely7-Jul-09 9:14 
GeneralRe: Sith Interviewing Tactics Pin
_Erik_8-Jul-09 5:43
_Erik_8-Jul-09 5:43 
GeneralRe: Sith Interviewing Tactics Pin
ProtoBytes15-Jul-09 4:33
ProtoBytes15-Jul-09 4:33 
GeneralRe: Sith Interviewing Tactics Pin
Paulo Zemek16-Jul-09 14:14
mvaPaulo Zemek16-Jul-09 14:14 
GeneralRe: Sith Interviewing Tactics [modified] Pin
ProtoBytes7-Jul-09 18:04
ProtoBytes7-Jul-09 18:04 
GeneralRe: Sith Interviewing Tactics Pin
ProtoBytes7-Jul-09 20:53
ProtoBytes7-Jul-09 20:53 
GeneralRe: Sith Interviewing Tactics Pin
_Erik_8-Jul-09 1:54
_Erik_8-Jul-09 1:54 
I think you have not got the point. What I mean is that when an intervewer asks you to solve a problem within some kind of restrictions, as "recursive way" to do "whatever", the really important thing here is not the problem itself, but the way you can solve it applying those restrictions.

That is why I have showed two possible ways to solve Fibonacci sequence in a recursive way. The first one is horrible because it has an exponential complexity, while the second one is linear. Sure, using golden proportion in this concrete case comes with a constant complexity algorithm, but you have not folowed the instructions. So, the problem here is not finding a Fibonacci number. The problem is to do it in a recursive way with a good performance. If the interviewer had asked you, for example, to find an iterative way to solve Hanoi's Tower problem, golden proportion would not be there to help you.

On the other hand, when you say recursion is bad, sorry, but you are absolutely wrong. Many abstract data types are recursive by definition, like trees or graphs. Just implement a non recursive way to find a file within a tree of folders. When you get it, do it recursive. When finished, analyze both of them, how they work and what they do under the covers. When you get finished, I think you will really appreciate the real value of recursion.
GeneralRe: Sith Interviewing Tactics Pin
ProtoBytes8-Jul-09 6:29
ProtoBytes8-Jul-09 6:29 
GeneralRe: Sith Interviewing Tactics Pin
ProtoBytes8-Jul-09 6:51
ProtoBytes8-Jul-09 6:51 
GeneralRe: Sith Interviewing Tactics [modified] Pin
ProtoBytes8-Jul-09 7:59
ProtoBytes8-Jul-09 7:59 
GeneralRe: Sith Interviewing Tactics Pin
_Erik_10-Jul-09 3:47
_Erik_10-Jul-09 3:47 
GeneralRe: Sith Interviewing Tactics Pin
ProtoBytes10-Jul-09 5:09
ProtoBytes10-Jul-09 5:09 
GeneralRe: Sith Interviewing Tactics Pin
exyyle21-Jul-09 17:54
professionalexyyle21-Jul-09 17:54 
GeneralRe: Sith Interviewing Tactics Pin
ProtoBytes21-Jul-09 17:58
ProtoBytes21-Jul-09 17:58 
JokeRe: I think the Interviwer missed my example of recursion Pin
ProtoBytes22-Jul-09 3:54
ProtoBytes22-Jul-09 3:54 
GeneralRe: I think the Interviwer missed my example of recursion Pin
exyyle22-Jul-09 6:52
professionalexyyle22-Jul-09 6:52 
GeneralA real Mess Pin
Bernard Laplace2-Jul-09 1:33
Bernard Laplace2-Jul-09 1:33 
GeneralRe: Swiss made Pin
OriginalGriff2-Jul-09 2:07
mveOriginalGriff2-Jul-09 2:07 
GeneralRe: Swiss made Pin
TommyTomToms2-Jul-09 4:06
TommyTomToms2-Jul-09 4:06 
GeneralRe: Swiss made Pin
Dave Kreskowiak2-Jul-09 4:06
mveDave Kreskowiak2-Jul-09 4:06 
JokeRe: Swiss made Pin
Gautier Boder21-Sep-09 3:54
Gautier Boder21-Sep-09 3:54 
GeneralRe: Swiss made Pin
Thomas Weller2-Jul-09 4:53
Thomas Weller2-Jul-09 4:53 
GeneralRe: Swiss made Pin
Dave Kreskowiak2-Jul-09 8:37
mveDave Kreskowiak2-Jul-09 8:37 
GeneralRe: Swiss made Pin
Alessandro Bernardi3-Jul-09 12:23
Alessandro Bernardi3-Jul-09 12:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.