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.
 
  • Post
  • Reply
Null Pointer
May 20, 2004

Oh no!

shrughes posted:

Any good developer would recognize that you can....
Number theory? Nonsense. Any good developer would recognize that lightbulbs get hot, and that the slowest people should cross bridges together.

Adbot
ADBOT LOVES YOU

Null Pointer
May 20, 2004

Oh no!

Daremyth posted:

Jesus christ, it's an interview problem.

Most interview problems you do will be written on a whiteboard.
This isn't even a whiteboard problem. This is a first round weed-out problem. It's fizzbuzz. It's two-dimensional and it uses scanf, but it's still fizzbuzz. It's so stupid simple that you can't even have a good discussion about it (cf. the last few pages, where the only real discussion is about how!!! being one minor head injury away from working the problem with UML).

An hour is generous for this problem, but it's not just about the time. We use architecture to cope with complexity. If you give me a (non-working) solution that leans on some high-level design work, I'm going to assume that you just aren't smart enough to be able to keep a 30-line C function in your head. And I'm probably right, too.

how!! posted:

The code I was trying to write was going to have obviously no bugs. A lot of the code in my github has obviously no bugs, and that code I'm proud of and will send to employers when they ask for a code sample. That kind code is very possible to write, and very fun to write, but also takes much more time.
Are you doing formal verification? If not, no, it's not obvious at all that the code you're writing has no bugs. (Edit: Just in case you didn't get what tef posted.)

Null Pointer fucked around with this message at 00:56 on Jul 11, 2012

Null Pointer
May 20, 2004

Oh no!

HineyBorelTheorem posted:

The reason it hangs is that your for-loop goes through 600851475141 iterations.
You're about 12 orders of magnitude off.

KidDynamite posted:

I think since I just finished that programming class that's the last thing I had in my mind. Also afterwords I couldn't figure out how to get my prime number checker working within the code regularly. I'm so bad at coding :smith:

Hints: Do you even need to test if a factor is prime? Is the least factor always prime? What do you have left if you divide a factor out of a number?

Spoiler: http://pastebin.com/fvifHVjL

Null Pointer
May 20, 2004

Oh no!

HineyBorelTheorem posted:

What am I missing?

His code is Java.

You're correct that there are 600851475143 outer loop iterations, but this isn't the basic operation of the algorithm. For outer loop iteration i, the algorithm also performs i-2 inner loop iterations.

Null Pointer
May 20, 2004

Oh no!

Zhentar posted:

If you pay attention and have a decent professor (and thus, actually learn things), it will probably be useful for a decently sized subset of programming jobs.
Microeconomics will be useful for the subset of programming jobs that involve exchanging your labor for money.

Null Pointer
May 20, 2004

Oh no!

how!! posted:

He told me me that my solution is better, but theres an even more optimized solution. At that point I pretty much realized he was looking for someone who thinks exactly like him, and that even if I were to happen to get the same solution as him, he is not the kind of person I want to work for. It wouldn't bother me so much if it weren't for the face that literally 99% of phone interviews end up like this.

You should study for your next interview by solving this problem for three numbers in polynomial time.

Null Pointer
May 20, 2004

Oh no!

Pweller posted:

The whole point is that the solution itself doesn't even matter at all so long as you explain what you're thinking along the way and don't give up until the interviewer is satisfied.

That, and it's a tractable instance of a well-known NP-hard problem with obvious applications (think finance and manufacturing). I can't say I'd be very impressed if someone I interviewed told me that the problem is unrealistic or can be avoided through architecture.

Null Pointer
May 20, 2004

Oh no!

how!! posted:

Real world problem solving is about understand the context surrounding the problem. A problem without context is not a problem, its a pointless puzzle. Why do you have a list of 1,000,000 integers? Why do you need to get numbers that add up to another number? What possible purpose does this code solve?

I have a mutual fund which holds 1,000,000 bonds of various values. A client wants to withdraw $k from the fund. What bonds do I sell?

What a contrived problem. :allears:

Null Pointer
May 20, 2004

Oh no!

how!! posted:

Databases are great at doing that sort of thing.

Ah yes, the infamous SUBSET_SUM aggregation operator. I think they added that in SQL 2192.

Null Pointer
May 20, 2004

Oh no!
Computer Science degrees are useless because as far as I could tell the people I used to work with (before I got fired for incompetence) never used their degrees for anything. That's why I deserve a pass for not understanding basic theory, or even giving enough of a poo poo about my own field to pick up a copy of CLRS. Also, you know, CLRS is a really heavy book, and it's all the way on the top shelf, so it's totally unreasonable for you to expect me to learn any of it.

Sigh. Well, if you're going to insist on asking me a theory question, at least give me a few hours to look it up on Google first.

Null Pointer
May 20, 2004

Oh no!

shrughes posted:

The solution isn't to rewrite the entire product?

No, that's just how you avoid NP-hard problems.

how!! posted:

Instead of trying to optimize through these types of algorithms, its best to redesign the system itself that makes this type of problem happen in the first place.

Null Pointer
May 20, 2004

Oh no!

Pie Colony posted:

So..although I'm relatively happy with my job I want to poke my head out and see what kind of offers I can get. I spent the last two hours updating my resume (so I haven't given it a really good look-over), does anyone have any tips? It's a lot better than my old one but it still feels like a bunch of bullshit

http://i.imgur.com/yCmhX8f.png

kinda short... but I don't think I could say anything else interesting about my jobs. I could add some side projects, but it feels weird putting that on my resume, especially with my github at the top. The two projects I could reference are a microprocessor emulator and a chess engine, but maybe I will get further with my toy compiler by the time I actually seriously look at jobs

Definitely cut your objective statement (everybody already knows your objective: get food so you don't die). Anything meaningful you'd put in your objective statement belongs in a cover letter. I would also suggest elaborating more about your specific responsibilities.

There's a dedicated thread in BFC for resumes. Career professionals post there so you'll probably get better advice.

Null Pointer
May 20, 2004

Oh no!

Suspicious Dish posted:

OK, so dependency injection is basically "implementing interfaces".

Why did we need a new term for that?

Dependency injection basically means not using "new" in your constructors.

Instead of objects instantiating components, they consume them from an external source. This can be as simple as passing components as constructor arguments, or as complex as using a DI tool to automatically inject the dependencies at run-time from a config file. The point is that you are able to isolate the behavior of your code from the code you call.

Null Pointer
May 20, 2004

Oh no!

Suspicious Dish posted:

I thought that was a factory?
Not exactly. The factory pattern is extremely useful for implementing DI when you aren't using a DI tool, but they're distinct concepts.

A factory lets you isolate complex object initialization code. DI is what made the initialization code complex in the first place.

Null Pointer
May 20, 2004

Oh no!

Tunga posted:

What, exactly, can LaTeX do that GDocs or Word can't?
Prettier typesetting. For example, Google Docs and Word use a greedy word wrapping algorithm that's optimized for speed so they can do a real-time preview. TeX uses an O(n^2) dynamic algorithm which minimizes the sum of squared space to the right of each line. The result looks more professional.

LaTeX sounds complicated but it's secretly a much lazier way to write. You can leave all of the styling minutiae up to document classes and packages, and you'll still end up with something that looks very good. But the advantages all sorta fall apart when you start talking about writing a custom document class for a one-off 1-2 page resume.

Adbot
ADBOT LOVES YOU

Null Pointer
May 20, 2004

Oh no!
Everybody knows you should write your resume in XML. That way the HR rep can write an XSLT stylesheet to convert it into whatever format and document type they prefer.

Nothing screams professionalism like having nothing better to do than eternally chasing the minimally non-technical way of completing simple tasks.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply