Nobody likes to be called a dummy by a dummy.

what do you think of this job

http://www.100quiz.com/

Trading systems. Is it worth it? I could take the quiz, get the $100. But would I fit in? Worth suffering through the interview process? Too stressful for this point in my life?
Permalink sharkfish 
January 2nd, 2006
Comp is v. good. (Senior Java Developers - comp to $250,000)

Why not check it out? What are you making now that you would turn up your nose at $100 or $100K?
Permalink  
January 2nd, 2006
I have friends who work on the trading floor here in Charlotte. No thanks. 70-80 hour weeks, stress out the wazoo, constant pressure. Remember, the traders also work business hours, so if you think you'll deploy updates then you are probably wrong.

I'd say stay away. If you can get into a trading floor shop surely you are good enough for others.
Permalink Cory Foy 
January 2nd, 2006
Make this function at least twice as fast (in the average case) on any modern PC for a length of 5,000:

  void back( int array[], int length ) {
    for (int i = 0; i < length; i++) {
      for (int j = i + 1; j < length; j++) {
        if (array[i] < array[j]) {
          int aj = array[j];
          array[j] = array[i];
          array[i] = aj;
        }
      }
    }
  }


So, we have here a bubble sort. What do they expect me to do to make it twice as fast? Some tweak to bubble sort? or a new sort algorithm?
Permalink  
January 3rd, 2006
There aren't any traders.  (See "About us".)
Permalink - 
January 3rd, 2006
yeah, I thought that, Cory Foy. I suppose I could apply and find out. But these kinds of places don't really hire people like me. I mean finance. Finance people think I'm a complete idiot, and I think the same of them. I don't know why it is that way, it just is.
Permalink sharkfish 
January 3rd, 2006
"So, we have here a bubble sort. What do they expect me to do to make it twice as fast? Some tweak to bubble sort? or a new sort algorithm?"

Yeah, this is why these firms hate me. I'd just Google "what is twice as fast as bubblesort" and get this and be done with it. They really want you to break your brain on this stuff, and it just isn't really something I find interesting. Maybe that's why....

http://linux.wku.edu/~lamonml/algor/sort/insertion.html
Permalink sharkfish 
January 3rd, 2006
That's why they don't want certain people in these jobs. Some of us are just too cynical to and too "mature" to deal with all the pretense. I mean, if you are too dumb to Google...

...also, what idiot would try to solve what has already been solved? I understand the why already. Why re-create the wheel?

Is Googling this stuff cheating? Now if I got past the online quiz and they came up with a pen and pencil test at the interview, I'd fail it because I don't remember all this stuff. And do I really want to be in a high pressure job where you don't have time to consider all the angles? Nope.

Next! Even for the dough, it isn't worth the daily humiliation.
Permalink sharkfish 
January 3rd, 2006
"Make this function at least twice as fast (in the average case) on any modern PC for a length of 5,000"

Do you feel like you've fallen into an evil alternate universe where everybody thinks they're Joel?
Permalink MarkTAW 
January 3rd, 2006
"I'd say stay away. If you can get into a trading floor shop surely you are good enough for others."

I'm too lazy. Even if I were "good enough", I would always be thinkin "ya know, for $75,000, I could be at home right now."
Permalink sharkfish 
January 3rd, 2006
"Do you feel like you've fallen into an evil alternate universe where everybody thinks they're Joel?"

Yes.
Permalink sharkfish 
January 3rd, 2006
I've done some work for hedge funds in the bay area. In my experience, you don't want to be directly supporting traders.

there are cool somewhat laid back jobs you can do for hedge funds. the best jobs i've seen were titled something like "quantitative research analyst." in my experience what this means is a lot of automated data mining which ends up in a sort of realtime report generating system which helps traders figure out what to buy and sell. for instance, at one place I created a bot that would look at a specific ecommerce site and try to build up a realtime profile of how much money the site was making based on what was being sold, how many orders were being placed, etc. it would compare this to the SEC filing of the company, and if the model i created for this quarter looked a lot worse than what the SEC filing looked like last quarter, then the traders would use that information to uh... short the stock next month... or something.

note there is a specialized niche where you are a "Quant". this typically means hardcore C++ along with hardcore excel programming conjuring up esoteric mathematical models applied to exotic financial products. these jobs seem to be all in NYC or London with a few in Chicago. It is pretty hard to get into that without a PhD in physics or mathematical finance.
Permalink scrappy 
January 3rd, 2006
"So, we have here a bubble sort. What do they expect me to do to make it twice as fast? Some tweak to bubble sort? or a new sort algorithm?"

It's not bubble sort. Look closely at the "if". Bubble sort compares adjacent entries in the array and moves up an element on each iteration whereas this algorithm is anchoring on a single fixed element on the left side of the array for each run of the inner loop and comparing it with every other item in the array to the right. I don't know what this algorithm is called (sorry, didn't go to Yale).

It's fairly simple to speed up the algorithm significantly with a few simple changes if you think about it for a little bit (I don't want to give away any spoilers). Of course, this begs the question, what do they consider a valid change to the algorithm? They mention "any modern PC" and "a length of 5,000" so are they going for some sort of tweak for a cache line optimization? Would it be okay to replace the entire algorithm with something entirely new but faster? Would it be okay to use the standard C library qsort which would likely be faster than any tweaks to that algorithm will ever be?
Permalink SomeBody 
January 3rd, 2006
For functions that needed be run billions times, 50% improvement is huge.

I guess even 20% improvement is well worth it..
Permalink Rick Tang 
January 3rd, 2006
"Finance people think I'm a complete idiot, and I think the same of them. I don't know why it is that way, it just is."

Move to Charlotte then. They're dying for good developers here - good developers meaning that you know that you don't have to do:

MyObject obj = null;

try
{
obj = new MyObject();
}//try
finally
{
obj = null;
}//finally

Which was a coding requirement when I worked at Wachovia. Any object you instantiated you had to do in a try block and set it to null in a finally block, and all closing brackets had to have a comment specifying what it was closing. Every Single One.

Here, you can rule, just by having a clue. And, since it's a banking town, there's lots of "finance" jobs - it's pretty easy find at least one, and then you've got the financial experience and they'll all hire you.
Permalink Cory Foy 
January 3rd, 2006
a few simple changes if you think about it for a little bit?

OK. I've been thinking and I give up.
Permalink  
January 3rd, 2006
void back( int array[], int length ) {
    for (int i = 0; i < length; i++) {
      for (int j = i + 1; j < length; j++) {
        if (array[i] < array[j]) {
          int aj = array[j];
          array[j] = array[i];
          array[i] = aj;
        }
      }
    }
  }

am i missing something here, or does this algorithm look like it doesn't work?

shouldn't it be:

for (int j = 1; j < length - i; j++) {

???
Permalink Kenny 
January 3rd, 2006
oops, nm.
Permalink Kenny 
January 3rd, 2006
void back( int array[], int length )
{
bool bSwap;
int i = 0;

do {
bSwap = false;
for (int j = i + 1; j < length; j++) {
      if (array[i] < array[j]) {
        int aj = array[j];
        array[j] = array[i];
        array[i] = aj;
bSwap = true;
      }
}
++i;
} while (bSwap == true);
}
Permalink Dave B. 
January 3rd, 2006
don't you have to initialize bSwap = false?
Permalink Kenny 
January 3rd, 2006
oops, i mean true
Permalink Kenny 
January 3rd, 2006
>>I don't know what this algorithm is called (sorry, didn't go to Yale).
Exchange sort, I presume?
Permalink Star Wars Kid 
January 3rd, 2006
ack, nm, again.
Permalink Kenny 
January 3rd, 2006
Dave,

Interesting idea to try to short-circuit the sort early.

Your code reads: if the ith item doesn't need to be swapped we're done. What it the ith item doesn't need to be swapped, but i+1 does?

How will the original code sort 9-5-6-4 ?

How will yours?

I think you have a bug.
Permalink  
January 3rd, 2006
>> "I think you have a bug."

Yup. Back to the drawing board.
Permalink Dave B. 
January 3rd, 2006
void back( int array[], int length )
{
bool bSwap;

do {
bSwap = false;
for (int j = 0; j < length - 1; j++) {
      if (array[j] < array[j + 1]) {
        int aj = array[j + 1];
        array[j + 1] = array[j];
        array[j] = aj;
bSwap = true;
      }
}
} while (bSwap == true);
}

Although this does not preserve the original algorithm.
Permalink Dave B. 
January 3rd, 2006
Short circuiting was my first thought too (since it's a classic bubble sort improvement) but then I realized this isn't bubble sort so it won't work.

This sorting algorithm works by iterating through each position starting at the left and searching each element at that position or greater for the maximum value in that range.

The improvement I was alluding to comes from recognizing that the algorithm is doing a whole lot of unnecessary swapping. There are essentially two tasks being done for each element -- (a) find the maximum in the subrange, (b) swap the maximum into the element. The algorithm as they've implemented it is the swapping every time it finds a new max, basically using the first element as a temporary for storing the current max. So it can be greatly improved simply by changing the inner loop to find the index of the maximum element in the subrange and then do the swapping once after that has been completed.
Permalink SomeBody 
January 3rd, 2006
>> Which was a coding requirement when I worked at Wachovia. <<

I worked there fora while, back when it was First Union.

Never again.
Permalink example 
January 3rd, 2006
Can you guys explain to me again what's so bad about making 250K? 

The 70 hour week I get. That's baddddddd news.

But 250K? I would work another 10 years and retire.
Permalink  
January 3rd, 2006
Func    Func+Child      Hit
    Time  %    Time  %  Count Function
---------------------------------------------------------
  152.880 47.3  152.880 47.3    1 back2(int * const,int) (back.obj)
  132.033 40.9  132.033 40.9    1 back1(int * const,int) (back.obj)
  37.872 11.7    37.872 11.7    1 back3(int * const,int) (back.obj)

Good job Somebody. That really made a huge difference.

back1 = original
back2 = bubble sort
back3 = Somebody's suggestion

* - Profile with MSVC 6.0 - 5000 element random integer array
Permalink Dave B. 
January 3rd, 2006
Nice work! How about this one: "Write a function that returns 1/3 of a number, rounded to the nearest integer as a double precision number and which works correctly for all numbers from negative infinity to positive infinity. (e.g. 3.3 -> 1.0, 5.0 -> 2.0)"


Is the infinity thing for real? Obivously a third of a number more than 3 times as large as a double can't be returned as a double?  Without dealing with infinity, it's trivial:

double third(double num)
{
    return round(num/3);
}
Permalink  
January 3rd, 2006
Yeah, I didn't quite get that question. You can represent negative and positive infinity with a double but you can't represent "all numbers" from negative to positive infinity with a double.
Permalink SomeBody 
January 3rd, 2006
I think the challenge may be that there is no round() function (or is there?)

I've solved similar problems to this by using the int() method, but it gets somewhat complicated based on the rules that int() uses.
Permalink - 
January 3rd, 2006
An update on the rounding:

I think there is a round() method in C# and Java, but it doesn't seem like there is one in C++.

If you have a positive integer then you can return floor(x + 0.5f) to round it correctly. However, the tricky part is that doesn't work if it is a negative number. I'll play with that a bit to figure out what works (some combination of adding/subtracting 0.5 and using floor/ceil) and also figure out how to handle infinite values.
Permalink - 
January 3rd, 2006
okay

1) There is a round defined in math.h in C++.

2) There is an IEEE definition for expressing infinity and -infinity within double variables.

3) The round() method correctly handles infinity and negative infinity (i.e. round(infinity) == infinity, round(-infinity) == -infinity).

4) I am assuming that infinity/3 will equal infinity.

Here is a good reference: http://www.codecogs.com/reference/math.h/round.php?alias=round


I still don't understand why they ask this question, though, because it seems pretty trivial using built-in functions.
Permalink - 
January 3rd, 2006
After some thought, and reading your posts, it occurred to me that while these quizzes are fun, I am much more interested in product development.

I hope my current boss is ready for a new product soon. Am I wierd? It seems like most people interested in programming enjoy the "art" more than me. Also, the details of patterns and architectures fascinate me more than optimization.

I suppose if I reviewed all my C++ materials I could be a marginal candidate for something like this job, but I'm pretty sure I wouldn't like it that much.

On the other hand, if someone were hiring for a software product that was at version 1.0 and needed some new features and research on what would sell, I'm there.

Doesn't seem to be a lot of that going on. Well-defined paradigms would bore me after awhile.

Maybe that's why I'm doing my own product. I guess. I still dream that I could work with other "stars" in a job sometimes, though.

Where are the software companies that are making new products (that aren't huge behemoths)?
Permalink sharkfish 
January 3rd, 2006
I'm sure trading apps have features and patterns and architecutre as much as your CRUD.
Permalink  
January 4th, 2006

This topic was orginally posted to the off-topic forum of the
Joel on Software discussion board.

Other topics: January, 2006 Other topics: January, 2006 Recent topics Recent topics