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
necrobobsledder
Mar 21, 2005
Lay down your soul to the gods rock 'n roll
Nap Ghost
I didn't read that statement as a judgement for your situation as much as commentary for others.

I've seen plenty of decade-long projects with terrible code exited successfully because the executives were well-connected enough to get the company sold to a sucker buyer somewhere. I'm including very well known tech entrepreneurs supposedly known for "quality", not just some small-time whatever software companies. I've seen companies with at least 4 total re-writes of the flagship software manage to plod along after small fundraising rounds and/or lobbying, too. If companies like Theranos can survive for years with basically a non-functioning product we can only guess how long useless companies can survive from our vantage points as employees far from the C-suite or board of directors.

Edit: to contribute a coding horror, I didn't realize until after I got off a whiteboard I wrote out a coding horror... O(n) space algorithm, O(n log n) time. It could have been done without pre-sorting anything in O(1) : O(k), k being a small constant. Ugh

necrobobsledder fucked around with this message at 23:04 on Oct 14, 2016

Adbot
ADBOT LOVES YOU

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

1337JiveTurkey posted:

edit: It'd be an amusing Goon Project to get those characters in wider use.

My favorite use is in the IRC Server RFC that nobody uses: https://tools.ietf.org/html/rfc2813

quote:

Optionally, the user status (channel modes 'O', 'o', and 'v') on the
channel may be appended to the channel name using a control G (^G or
ASCII 7) as separator.

Of all the separator characters they could have chosen, they chose an ASCII bell...

brap
Aug 23, 2004

Grimey Drawer
Constant factors aren't shown in big-O notation so if k is a constant then it's just O(1).

The real horror is people who believe that understanding big-O implies an understanding of how to analyze performance in the real world.

UraniumAnchor
May 21, 2006

Not a walrus.
A bit old but it popped up in my Twitter feed today and it seems relevant:

http://gwan.ch/blog/20160405.html

(Coding interview horrors.)

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

fleshweasel posted:

Constant factors aren't shown in big-O notation so if k is a constant then it's just O(1).

The real horror is people who believe that understanding big-O implies an understanding of how to analyze performance in the real world.

This. Please claim traversing Linked Lists are O(n) on a modern processor. :allears:

MrMoo
Sep 14, 2000

UraniumAnchor posted:

A bit old but it popped up in my Twitter feed today and it seems relevant:

http://gwan.ch/blog/20160405.html

(Coding interview horrors.)
:lol: I remember those screener questions, I remember the time taken question because Google just published a paper stating how context switches are the slowest now; I also said SIGKILL when the interviewer wanted SIGTERM; the better answer to bit counting is using the POPCNT x64 assembler or compiler intrinsic, however also not on the interviewers answer sheet.

Fergus Mac Roich
Nov 5, 2008

Soiled Meat

Simulated posted:

This. Please claim traversing Linked Lists are O(n) on a modern processor. :allears:

I am claiming this, with the caveat that the N in question has an eon for a coefficient.

sarehu
Apr 20, 2007

(call/cc call/cc)

Simulated posted:

This. Please claim traversing Linked Lists are O(n) on a modern processor. :allears:

It is O(n). It is also O(1).

Fergus Mac Roich
Nov 5, 2008

Soiled Meat

sarehu posted:

It is O(n). It is also O(1).

Can you explain the latter?

vOv
Feb 8, 2014

Fergus Mac Roich posted:

Can you explain the latter?

All computers have finite memory+storage, therefore the time it takes to traverse a linked list is bounded above by a constant, therefore it's O(1).

sarehu
Apr 20, 2007

(call/cc call/cc)

Fergus Mac Roich posted:

Can you explain the latter?

Modern processors only have 64 bits, and it's O(64), which is O(1).

taqueso
Mar 8, 2004


:911:
:wookie: :thermidor: :wookie:
:dehumanize:

:pirate::hf::tinfoil:

The algorithm is run once (1) each time it sorts a list. Thus it is O(1).

Fergus Mac Roich
Nov 5, 2008

Soiled Meat

vOv posted:

All computers have finite memory+storage, therefore the time it takes to traverse a linked list is bounded above by a constant, therefore it's O(1).

Does that mean if we can prove that the universe will end one day, all algorithms are O(1)?

Impotence
Nov 8, 2010
Lipstick Apathy

UraniumAnchor posted:

A bit old but it popped up in my Twitter feed today and it seems relevant:

http://gwan.ch/blog/20160405.html

(Coding interview horrors.)

From what I remember this dude used to shill his software on webhostingtalk and a few other forums with socket puppy accounts (or had his friends do it), and also had quite a bit of a god complex (bit of an understatement), especially when people asked him to support FastCGI for PHP on his webserver, that was a hilarious response

necrobobsledder
Mar 21, 2005
Lay down your soul to the gods rock 'n roll
Nap Ghost

taqueso posted:

The algorithm is run once (1) each time it sorts a list. Thus it is O(1).
Close, there is one list being sent to the algorithm, so its input size is constant.

I'm loving the idea of Donald Trump coder as a gimmick Twitter account

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

Coffee Mugshot posted:

Keybindings discussions might as well be plane on treadmill discussions tbh.

So there's one objectively right answer, but nobody can agree on what it is? :v:

(Sounds about right)

b0lt
Apr 29, 2005

necrobobsledder posted:

Close, there is one list being sent to the algorithm, so its input size is constant.

I'm loving the idea of Donald Trump coder as a gimmick Twitter account

https://twitter.com/isotrumpp/status/786015255910428672

qntm
Jun 17, 2009

Fergus Mac Roich posted:

Does that mean if we can prove that the universe will end one day, all algorithms are O(1)?

Also, every program halts.

Xarn
Jun 26, 2015

Fergus Mac Roich posted:

I am claiming this, with the caveat that the N in question has an eon for a coefficient.

Interestingly enough, assuming linked list with nodes scattered randomly across the memory, its closer to N log N, because you get hosed by virtual memory <-> physical memory mapping.

Obviously assuming real CPUs for analysis and not the idealized RAM.

Fergus Mac Roich
Nov 5, 2008

Soiled Meat

Xarn posted:

Interestingly enough, assuming linked list with nodes scattered randomly across the memory, its closer to N log N, because you get hosed by virtual memory <-> physical memory mapping.

Obviously assuming real CPUs for analysis and not the idealized RAM.

That's a different N, though. That's N with the size of whatever index is used to look up memory locations.

Space Kablooey
May 6, 2009


UraniumAnchor posted:

A bit old but it popped up in my Twitter feed today and it seems relevant:

http://gwan.ch/blog/20160405.html

(Coding interview horrors.)

This guy is so smug it's painful to read.

Volte
Oct 4, 2004

woosh woosh

UraniumAnchor posted:

A bit old but it popped up in my Twitter feed today and it seems relevant:

http://gwan.ch/blog/20160405.html

(Coding interview horrors.)
Interviewer: what's 1 + 1?

Me:


Interviewer: Wrong, it's 2

Me: :ssj:

xzzy
Mar 5, 2009

To be fair, he did get some answers right and the screener was all "NOPE it's gotta be a perfect text match to what I got written down!!"

If it was an actual technical interview with a skilled interviewer he probably would have done a lot better.

Spatial
Nov 15, 2007

The interviewer reads like someone going through the motions, who really doesn't want to hire anybody but has to look like they tried.

Maybe afterwards they rollerskated away in a huff and couldn't quite get out the door.

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Spatial posted:

The interviewer reads like someone going through the motions, who really doesn't want to hire anybody but has to look like they tried.

Maybe afterwards they rollerskated away in a huff and couldn't quite get out the door.

I was totally expecting the "I'm late... for business" meme.

Storysmith
Dec 31, 2006

Spatial posted:

The interviewer reads like someone going through the motions, who really doesn't want to hire anybody but has to look like they tried.

Maybe afterwards they rollerskated away in a huff and couldn't quite get out the door.

It reads like a recruiter doing the "Sorry, we couldn't find any qualified applicants for this posting in America" H1B dance, but apparently in Switzerland.

Storysmith fucked around with this message at 19:14 on Oct 15, 2016

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Fergus Mac Roich posted:

That's a different N, though. That's N with the size of whatever index is used to look up memory locations.

This. If you're going to add a log K factor to account for virtual memory resolution, you need to add a log K factor for copying pointers around. And literally every algorithm ends up with that factor. It's a pointless formalism unless you really need to model it, e.g. if you've got distributed memory.

Volte
Oct 4, 2004

woosh woosh

xzzy posted:

To be fair, he did get some answers right and the screener was all "NOPE it's gotta be a perfect text match to what I got written down!!"

If it was an actual technical interview with a skilled interviewer he probably would have done a lot better.
Intentional or not, that kind of interview weeds out people (like this guy) who are bad communicators. You might be the best programmer in the world, but if you can't figure out that the person talking to you isn't receptive to your ultra-technical pseudo-answers and adjust accordingly (or you refuse to "dumb down" your answers out of pride or something), then maybe the interview is doing its job after all.

Most of his answers are non-answers, or make unwarranted assumptions about the question just to show off his specific technical knowledge. "There's an array of 10,000 16-bit values, how do you count the bits most efficiently?" and he starts talking about 64-bit words for some reason? Maybe they want to run this algorithm on a Motorola 68k for all he knows. Even in his followup he starts talking about 8-bit lookup tables being too small and 64-bit lookup tables being too big, when clearly they wanted him to make a 16-bit lookup table. Sadly he's too "clever" and didn't even consider that option apparently.

hobbesmaster
Jan 28, 2008

rjmccall posted:

This. If you're going to add a log K factor to account for virtual memory resolution, you need to add a log K factor for copying pointers around. And literally every algorithm ends up with that factor. It's a pointless formalism unless you really need to model it, e.g. if you've got distributed memory.

And log n is bounded above by n log n

xzzy
Mar 5, 2009

I get that, he'd fail any interview on personality, but there's a valid argument for an interviewer to accept more than an exact string match.

Nippashish
Nov 2, 2005

Let me see you dance!
That guy is so angry and insufferable that I'm not sure its wise to give him the benefit of the doubt on his presentation of the interviewer's attitude.

Volte
Oct 4, 2004

woosh woosh

xzzy posted:

I get that, he'd fail any interview on personality, but there's a valid argument for an interviewer to accept more than an exact string match.
Maybe, but none of his "valid but not valid" answers struck me as particularly uh... valid. I'd give half marks at most if I were a TA. His answer about an inode being an index is particularly wrong, since an inode is a data structure. His semantic quibbling about whether stat() "returns" an inode doesn't help. He also had to drop that he wrote a custom libc for his product, as if that bestows any validity upon his answers. He doesn't even answer the quicksort question (merely states that the question is invalid), overanalyzes yet still manages to be wrong about the lookup table question, and gives an arcane answer to the TCP question when a simple one would have sufficed. These are all things that give hints as to what kind of developer he would be: stubborn, narrow-minded, gets bogged down in details, can't see forest for trees.

hobbesmaster
Jan 28, 2008

If you're thinking in "gotcha" C questions mode "those functions return error codes" isn't too unreasonable a trap to fall into.

I'm sympathetic because half of my recruiting calls with google itself used some sort of god awful VoIP system that cut out half of every sentence. I still passed, but primarily because I had a coding screen using a shared google doc and communicating through text did work.

hobbesmaster fucked around with this message at 21:53 on Oct 15, 2016

speng31b
May 8, 2010

Volte posted:

Maybe, but none of his "valid but not valid" answers struck me as particularly uh... valid. I'd give half marks at most if I were a TA. His answer about an inode being an index is particularly wrong, since an inode is a data structure. His semantic quibbling about whether stat() "returns" an inode doesn't help. He also had to drop that he wrote a custom libc for his product, as if that bestows any validity upon his answers. He doesn't even answer the quicksort question (merely states that the question is invalid), overanalyzes yet still manages to be wrong about the lookup table question, and gives an arcane answer to the TCP question when a simple one would have sufficed. These are all things that give hints as to what kind of developer he would be: stubborn, narrow-minded, gets bogged down in details, can't see forest for trees.

Possibly, but again, at the phone screen level where an interviewer is expecting answers off a sheet, it's implausible that they're screening for complex personality factors unless the tone was way more aggressive and unpleasant than what was conveyed - which may well be the case. Maybe I'm wrong. I think this is such a controversial topic because it seems like both sides were a bit off, if you take the transcript at face value. I think more likely, and as one Google employee has already suggested on reddit, we have an unreliable narrator.

Anyhow, the guy obviously thinks he's way hotter poo poo than he is. If his poo poo was indeed so unpleasantly warm, why is he being brought in at the phone screen level? Why doesn't he have a dozen contacts who will vouch that he's experienced and great to work with?

speng31b fucked around with this message at 21:56 on Oct 15, 2016

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
Taking his presentation of the interview 100% at face value: his answers about inodes are correct, and the interviewer might not fully understand the concepts involved. An inode is a filesystem object which is hard-linked into various places in the directory tree. It has metadata (and that metadata can indeed be thought of as a collection of attributes), but it is fundamentally more than its metadata: it's a thing with its own identity independent of any process. You can't really return an inode in its proper sense any more than you can return a person or a server. stat returns the current copy of some of the metadata from an inode as well as an (unsafe weak) reference to the inode represented as a integer.

Now programmers, as human beings, often gloss over the difference between "the thing" and "a reference to the thing" when they're talking. This is totally reasonable and understandable and okay. A candidate who can't just roll with it is failing to communicate effectively; it's a failing that's pretty common among people who are, let's say, quite a ways out on the spectrum, and while that might justify a bit of patience and understanding, it's also a failing that does actually seriously and continually impact their ability to work with other people, so it's not really unfair to take it into account. Anyway, I would expect a candidate to understand this question as "what syscall returns a reference to an inode given a path", for which the answer is indeed "stat". But then the interviewer's comment about "the inode contains all the metadata" really makes it sound like they don't understand that the inode is more than just the stat struct, and that's a pretty big red flag — assuming, again, that his presentation of the interview is 100% faithful.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

hobbesmaster posted:

And log n is bounded above by n log n

I have no idea what you're trying to say here. Xarn said that walking a linked list is N log N; Fergus correctly pointed out that it's N log K, where K is the size of the address space; and I added that if you're including this "size of the address space" factor, you need to apply it to everything instead of singling out linked lists. Indexing into an array is O(log K). You can try to make a locality argument to drop this factor because of translation caches, but now you're talking about a sequence of operations, because reading a single array element at a random index does not in fact have some sort of inherent, magical locality. And if you're walking an entire array, you are still going to have to translate a linear number of pages at O(log K) per translation, even if you're only falling into that O(log K) expensive case 1/whatever-th as often as you would if you were walking a linked list.

rjmccall fucked around with this message at 23:20 on Oct 15, 2016

sarehu
Apr 20, 2007

(call/cc call/cc)
On HN and Lobsters there are two different people who remember that guy from two different forums/situations (I think) saying, yeah, take this story with a grain of salt.

rjmccall posted:

But then the interviewer's comment about "the inode contains all the metadata" really makes it sound like they don't understand that the inode is more than just the stat struct, and that's a pretty big red flag

My understanding from what I've read is that this isn't a dev, it's some idiot recruiter phone screening you for the actual phone screen.

Hughlander
May 11, 2005

The other thing to consider is if they are interviewing for a Director of Engineering, it's even more obvious he's not going to work out. Makes me want to ask a SRE interview screen just to see how people deal with the different expectations. That's not the person you want owning multiple groups of engineers...

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice

Fergus Mac Roich posted:

That's a different N, though. That's N with the size of whatever index is used to look up memory locations.

My original post was trying to point out that Big-O often doesn't explain actual performance and you should be careful when using it as a proxy for performance. A data structure with theoretical O(N) performance can be easily beaten by one with O(log N) performance if the latter makes better use of cache.

Summing the elements in a linked list and summing the elements in an array are both O(N) in theory; they should both execute around the same number of instructions. In reality the array will be faster and the larger your dataset (or the more spread out the linked list nodes) the faster the array will be. For a 1 GB dataset the array can absolutely kill the linked list, in some scenarios by an order of magnitude. How useful was knowing they are both O(N) if one takes 10x as long to execute?

I wonder if the most practical benefit of thinking about Big-O is avoiding the exponential algorithms.

Adbot
ADBOT LOVES YOU

hobbesmaster
Jan 28, 2008

Simulated posted:

My original post was trying to point out that Big-O often doesn't explain actual performance and you should be careful when using it as a proxy for performance. A data structure with theoretical O(N) performance can be easily beaten by one with O(log N) performance if the latter makes better use of cache.

Summing the elements in a linked list and summing the elements in an array are both O(N) in theory; they should both execute around the same number of instructions. In reality the array will be faster and the larger your dataset (or the more spread out the linked list nodes) the faster the array will be. For a 1 GB dataset the array can absolutely kill the linked list, in some scenarios by an order of magnitude. How useful was knowing they are both O(N) if one takes 10x as long to execute?

I wonder if the most practical benefit of thinking about Big-O is avoiding the exponential algorithms.

This is why a common interview question is to explain when you shouldn't use quick sort.

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