IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Phew
Eons ago when I was a baby C programmer my company would give C tests
to applicants. The final question was to implement a sort program. Not to call qsort(), but to actually write the full implementation. If you did a bubble sort they laughed you out of the office. Shell and Quicksorts were acceptable. Are there any others commonly used? I dunno. I used to.

I was just learning C, after being hired as tech support, so I didn't have to suffer though it.
New This may be too harsh
for a junior coder.

I would provide the algorithm, and ask him/her to code it.
Or ask how quicksort works, on paper.

But not both.

In fact, I am pretty sure I can't code proper quicksort in a hurry. That's what books/compilers/debuggers/unitttests are for.
--

Less Is More. In my book, About Face, I introduce over 50 powerful design axioms. This is one of them.

--Alan Cooper. The Inmates Are Running the Asylum
New Exactly
I would ask

What is an exact equivalent syntax to *(*(A+m) + n) not using asterisks?

I think pressure programming proves nothing. It's like a hotdog eating contest. I would stress theoretical aspects of the language and how it fits together to make programs, calling library functions, proper division between headers and code etc. If you understand the implications of the language then you will at worst be a sloppy implementor.
-drl
New This is not "pressure programming"
This is an ansient and venerable algorithm of removing elements that match certain criterion from an array. Expressed in the candidate's language of choice (English for Barry).

Your example, on the other hand, is extremely C-dependent, not algorithmic at all.
--

Less Is More. In my book, About Face, I introduce over 50 powerful design axioms. This is one of them.

--Alan Cooper. The Inmates Are Running the Asylum
New Yes, precisely
A monkey can implement and algorithm (place box, step on, retrieve banana). What you want is real understanding of the semantics of the medium at hand. IMO.
-drl
New That particular algorithm has been really successful
at weeding out people with no understanding of medium whatsoever.
For the rest, there are other tests.
--

Less Is More. In my book, About Face, I introduce over 50 powerful design axioms. This is one of them.

--Alan Cooper. The Inmates Are Running the Asylum
New They did not do this to juniors
Like I said, they didn't do it to me.

But this was in the days of pre-ANSI K&R C. Very limited libraries. Very few coders. Using "real" Unix or original Tandy 6000 Xenix.

There were far fewer candidates in those days, and they were of much higher quality than now, simply because the barriers to entry were far higher.

It was not too much too ask then.

It would be now.
New Re: Phew
Did you give the algorithm?
-drl
New Insertion Sort
Many systems, it seems, use an "insertion sort", especially when I was in the mainframe world.

Insertion sort basically takes an "old" data set, and builds a "new" data set by inserting the records in order. The "old" unsorted set still remained, until the next job step deleted it.

It was pretty fast.

Glen Austin
New Merge Sort is better
and I think really common in the mainframe world - because you can use it with tape drives if you have to and can sort enormous datasets in very little extra space with great speed.



"One of the main causes of the fall of the Roman Empire was that,
lacking zero, they had no way to indicate successful termination
of their C programs."
-- Robert Firth
New What a waste of time
I can't remember how to do a qsort. I'd have to look it up. I vaguely recall finding a pivot and then recursively sorting the sublists on either side of it.

I got the same thing on an interview the other day. Wanted to know how to write a server that listened on a socket and forked requests into different threads. I said you do something like open, then select or poll or something like that to wait for the connection and I can't remember exactly but this is boilerplate code I can find on the web or in any basic unix network programming manual.

Seemed to satisfy him. After all, its true.



"One of the main causes of the fall of the Roman Empire was that,
lacking zero, they had no way to indicate successful termination
of their C programs."
-- Robert Firth
New I think qsort is a bad example.
I only now have an idea how it works because I've read that chapter in my Algorithms book several times!

Wade.

Is it enough to love
Is it enough to breathe
Somebody rip my heart out
And leave me here to bleed
 
Is it enough to die
Somebody save my life
I'd rather be Anything but Ordinary
Please

-- "Anything but Ordinary" by Avril Lavigne.

Expand Edited by static July 11, 2003, 10:25:16 AM EDT
New I'm trying hard to recall
...the last time I wrote code to sort anything. Been years now. "ORDER BY", anyone? ;)


I'm gonna go build my own theme park! With Blackjack! And hookers! In fact, forget the park!
     Another "removeSpaces" from a job candidate - (Arkadiy) - (59)
         Bleurrrgh. -NT - (admin)
         You have a *great* need for a coder! :) -NT - (a6l6e6x) - (1)
             LPRD sez: Able to chew and walk gum at the same time. :) -NT - (Arkadiy)
         Help me - (broomberg) - (30)
             You pass. - (Arkadiy) - (29)
                 Depends. - (admin) - (15)
                     Agreed. - (Yendor) - (9)
                         Not buying it... - (gdaustin) - (8)
                             And I'm not buying yours... - (Yendor) - (7)
                                 I'm saying that a Computer Science or MIS Grad Student - (gdaustin) - (6)
                                     This is not a friggin' function! - (Arkadiy) - (5)
                                         Yep, the guy doesn't understand null terminated strings. - (a6l6e6x) - (4)
                                             Is that like - (Ashton) - (3)
                                                 Nope, that's null-terminated chain. -NT - (Arkadiy)
                                                 Nope - (ben_tilly)
                                                 Oh, is THAT how you reverse-engineer Microsoft code? - (FuManChu)
                     Next time I see someone like that, - (Arkadiy) - (1)
                         Next time you see someone like that - (tuberculosis)
                     Also depends on the College - (Simon_Jester) - (2)
                         He did not use STL because of the way I posed the question - (Arkadiy) - (1)
                             ah - now I understand - (Simon_Jester)
                 Phew - (broomberg) - (12)
                     This may be too harsh - (Arkadiy) - (5)
                         Exactly - (deSitter) - (3)
                             This is not "pressure programming" - (Arkadiy) - (2)
                                 Yes, precisely - (deSitter) - (1)
                                     That particular algorithm has been really successful - (Arkadiy)
                         They did not do this to juniors - (broomberg)
                     Re: Phew - (deSitter)
                     Insertion Sort - (gdaustin) - (1)
                         Merge Sort is better - (tuberculosis)
                     What a waste of time - (tuberculosis) - (2)
                         I think qsort is a bad example. - (static) - (1)
                             I'm trying hard to recall - (FuManChu)
         Re: Another "removeSpaces" from a job candidate - (orion)
         okies yankout spaces - (boxley) - (20)
             Re: okies yankout spaces - (gdaustin) - (19)
                 In Visual BASIC 6.0 and above - (orion) - (1)
                     Nope -NT - (Arkadiy)
                 s/ //g -NT - (ben_tilly) - (6)
                     (string findTokens: ' ') inject: '' into: [:a :b | a,b] -NT - (tuberculosis) - (3)
                         beautiful :) -NT - (deSitter)
                         Doh! Better: string select: [:ea | ea ~= $ ] - (tuberculosis) - (1)
                             Or maybe (string copyWithout: $ ) - (tuberculosis)
                     Right before he left, he tried to rally in Perl - (Arkadiy) - (1)
                         He might have been better at C++ -NT - (ben_tilly)
                 Perl - (pwhysall) - (3)
                     Perl redux - (Steve Lowe) - (2)
                         sed 's/ //g' filename.txt > filename2.txt - (drewk) - (1)
                             key difference, though. - (Steve Lowe)
                 Java - (gdaustin) - (5)
                     Wow, that's a lot of typing :-P -NT - (tuberculosis)
                     n^^2 for the worst case - (Arkadiy) - (2)
                         Yes you can -NT - (Arkadiy) - (1)
                             You're looking for "best algorithm" - (gdaustin)
                     Re: Java - off the top of my head... - (Simon_Jester)
         Fun with code... - (gdaustin) - (2)
             I can tell you what will happen - (Arkadiy) - (1)
                 Will have to wait for Monday... - (gdaustin)

It got me an A+ on a psych paper.
157 ms