Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Xarn
Jun 26, 2015

leper khan posted:

I hate to dredge it up, but there's a closed form expression for the nth Fibonacci number so recursion or iteration are clearly the wrong thing to use.

I know of two closed form solutions for Fibonacci series. One of them is inefficient as gently caress and requires operations on arbitrarily sized numbers, the second one starts giving wrong solutions pretty quickly.

I can easily write efficient (log n counting multiplication and addition as constant time :v:) solution by matrix exponentiation thats 100% accurate, so...

Adbot
ADBOT LOVES YOU

Xarn
Jun 26, 2015
Yeah, lawsuits tend to ruin things for everyone. And it is not just US thing, here in Europe my mother's company fired a guy who provably falsified trip expenses and got sued by him in return.

Unsurprisingly, he got his rear end handed to him in court, but...

Xarn
Jun 26, 2015

feedmegin posted:

Why modulus? In C its just for(count=1; count<1000;count +=2) { sum += count; } or similar...

That only works if you are iterating like a savage...

Obviously only the closed form solutions is good enough for a discerning interviewer.
code:
def sum_of_arithmetic_sequence(start, ceil, step = 1):
    n = (ceil - start - 1) // step + 1
    last = (n-1)*step + start
    return n*(start+last) // 2
:v:

Xarn
Jun 26, 2015

feedmegin posted:

Also, and this is a small thing, but I assume C# has the usual logic operators, in which case '(foo & 0x1) == 1' is probably better than foo % 2. I mean, a decent compiler should optimise the latter to the former anyway, but at the hardware level modulus is either a lot slower than an and (on x86 for instance) or not even in the ISA (for ARM).

Oh god no. Write intent first, savagely optimize if you can prove that it helps and optimizer won't do it for you.

Xarn
Jun 26, 2015

leper khan posted:

Another got super confused when I provided a solution in big-theta(NlogN).

No wonder he was confused, who the hell specifies big theta? :v:

Xarn
Jun 26, 2015

MrMoo posted:

Most in the UK are ~3.5GPA (2.1) but thankfully HR don't always block lower applicants.

I'm starting to look at the jobs on Gambit NY and they are seriously :lol: How do they filter out the masses of applicants for jobs with 350-700K posted salaries? Some of the shortest job descriptions ever.

I'm starting to see less of the Boost hatred adverts, but one dufus one is still there:

Oh god, I think I hate this more than when a company publicly advertises they are looking for ninjas and rockstars.

Xarn
Jun 26, 2015

The_Franz posted:

Simple, they just don't use them.

People hate Boost because it's the basically the poster child for the bad parts of C++. Basically because of philosophies like this. Oh, you have a nice simple function that does exactly what you need? Well, that's no good. Here, let's pile on layers of templates and dependencies until it's unreadable by mere mortals, 5x larger than it needs to be, takes 2x longer to compile and vomits 100 line error messages if you make a simple mistake. But, hey, it can now handle some generic edge case you don't actually need it to!
Them be fighting words, but I knew what you were linking to even before I moused over the link... :v:

My opinion and experience is that some parts of Boost are pretty horrible, but some are really awesome, which is the reason why its getting into standard. Also there is Boost Spirit. :v:

Xarn
Jun 26, 2015

ultrafilter posted:

It might be that the CEO's a snob, but it might also have been the right choice. Not having a degree is a social liability in some circles, and at a lot of companies, tech director is a position where it's important to be able to navigate those circles.

That reminds me, at my last job, the CEO was an university professor and prided himself on only employing people with degrees. This became really funny when he was meeting with some people from company we made software for and started introducing people like

"this is Mr So-and-So, with Masters Degree from Such-and-Such university"
"this is Mr So-and-So, with Bachelors Degree from Such-and-Such university"
"this is Mr So-and-So, with Masters Degree from Such-and-Such university"
...
"And this is Mr So-and-So, with Masters Degree from ..."
"no"
"Well, with Bachelors Degree from ..."
"no"
"?"
"no degree".


Said person was one of our most productive and SW-smartest guys. :v:

Adbot
ADBOT LOVES YOU

Xarn
Jun 26, 2015

MrMoo posted:

"what is the most misfortunate feature of C++11?" idk :wtf:

Let me tell you about std::memory_order_consume and friends. :v:

It was underspecified, impractical and possibly unimplementable. IIRC it is being fixed in C++17 (or maybe it was already fixed in C++14, I prefer to keep myself to sequentially consistent atomic variables, unless absolutely necessary).


Also, std::bind is actually from TR1, predating C++11 by quite a lot. :science:

  • Locked thread