Thread: What concepts does CS student learn that will be very crucial in programming world?

  1. #16
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by stevesmithx View Post
    Here is a funny post on Slashdot that I found on the topic.
    Aye. I've been through that. I too don't include these kind of questions in an interview for a long while. But with one exception:

    I will on the odd occasion that I once need to hire a top-level coder or analyst. Then, those questions become useful as a means to build a rough framework for the subsequent interviews. They can help spot trouble areas or genuine areas of interest (they work as excellent candidate-smells) that you may wish to explore in the interviews that will follow with that candidate. But for junior or even senior coding positions, I prefer to try and gauge a candidate soft skills from his his resume and how he performs during the interviews.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  2. #17
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by Nominal Animal View Post
    Unless, of course, you mean problems that cannot be solved within the constraints given.
    They are more or less of that kind.

    Quote Originally Posted by Nominal Animal View Post
    Those are uninteresting, like asking to measure the circumference of the world using a nail file, a shovel with a broken handle, a used napkin, and a dried out red sharpie. Uninspiring, demotivational, just tricky. There's no point, nothing to gain by solving those.
    The idea is to grasp the candidate problem analysis abilities, not just his problem solving. My software development team is small. We don't benefit from a large number of developers that can more easily cover the disadvantages of each other. So I tend to need candidates that can perform a above the average and have a wider spectrum of abilities. If in my team no one is good at software analysis, I'm in trouble.

    So, other than the usual Solve questions, I also like to introduce trick questions mean to test the candidate ability to detect problems in the actual problem formulation. I tend to cycle these and don't usually talk about them. But here's one from last year:

    Michael always runs at least as fast as Michel, while Mikel runs at least as fast as Michael and Michel can never run faster than Michael. If in one day Michel runs at 13.9 m/s and and Mikel runs at 49.68 km/h, at what speed did Michael run that day? Code a generic algorithm that can answer this question and round your answer to the nearest tenth of a meter per second.
    Last edited by Mario F.; 09-12-2015 at 01:16 PM.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #18
    Ticked and off
    Join Date
    Oct 2011
    Location
    La-la land
    Posts
    1,728
    I asked, because I was bored.

    Quote Originally Posted by Mario F. View Post
    So I tend to need candidates that can perform a above the average and have a wider spectrum of abilities.
    Yup, sounds a good approach to me. (I personally prefer teams with disparate but slightly overlapping abilities. If you/leader can glue it together with trust and so on, the results are often surprisingly good, considering the resources available.)

    Quote Originally Posted by Mario F. View Post
    Michael .. Michel .. Mikel
    Yeah, Mikel running at 49.68 km/h = 13.8 m/s, Michel at 13.9 m/s, and stating Mikel >= Michael >= Michel is contradictory.

    But darn, those names are clever/nasty. I have to first rewrite the question with A, B, C, then convert to logical notation (equalities and inequalities -- would that actually be called mathematical notation in English? I dunno), then re-read it to verify. Then re-check it again.

    Solving such problems are in general interesting, because you're dealing with equalities and inequalities with sets of spans, instead of scalars, and the result sets tend to be un-intuitive. The only approach I currently know of, starts with unknown variables being defined as spanning all reals, then applying the equalities and inequalities, until all variables are as restricted as they can be, or there is a contradiction.

  4. #19
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by Nominal Animal View Post
    Yeah, Mikel running at 49.68 km/h = 13.8 m/s, Michel at 13.9 m/s, and stating Mikel >= Michael >= Michel is contradictory.
    Oops. That part was my mistake. That's not what I want you to get. I was just working from memory and used different values from the original and ended up swapping them. Let me rephrase:

    Michael always runs at least as fast as Michel, while Mikel runs at least as fast as Michael and Michel can never run faster than Michael. If in one day Michel runs at 49.68 km/h and and Mikel runs at 13.9 m/s, at what speed did Michael run that day? Code a generic algorithm that can answer this question and round your answer to the nearest tenth of a meter per second.


    But darn, those names are clever/nasty. I have to first rewrite the question with A, B, C, then convert to logical notation (equalities and inequalities -- would that actually be called mathematical notation in English? I dunno), then re-read it to verify. Then re-check it again.
    The idea with the names is to misguide the candidate into concentrating on the wrong part of the problem. /hint

    Anyways, give it a go now...
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  5. #20
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    You know, Mario, if Nominal gets this, you're going to, like, have​ to give him a job offer.

  6. #21
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by MutantJohn View Post
    You know, Mario, if Nominal gets this, you're going to, like, have​ to give him a job offer.
    Fat chance of that ever happening. Neither I would be interested in paying him his true worth.

    My team is made of four developers. Every single one of them much better programmers than I. And that is something that I'm very proud of. Meanwhile I just run things now, and manage the projects. But the masters in these boards, people like Nominal, Laserlight, Salem, Phantomotap,... they don't exactly come knocking at my door. I have yet to have interviewed even one candidate of their caliber.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  7. #22
    Ticked and off
    Join Date
    Oct 2011
    Location
    La-la land
    Posts
    1,728
    I'm pretty sure I'm being stupid here (phrase "led like a puppy in tow" comes to mind), but I don't mind. I kinda asked for it

    Quote Originally Posted by Mario F. View Post
    Let me rephrase:
    I'm assuming the 'trick' is that there is no scalar solution. We have
    michael >= michel
    mikel >= michael
    michel <= michael
    michel = 13.8 m/s
    mikel = 13.9 m/s
    which is satisfied with
    michael = [ 13.8 m/s .. 13.9 m/s ]
    which could also be written as
    13.8 m/s <= michael <= 13.9 m/s
    In other words, we don't know the exact speed Michael had, but if it was between 13.8 m/s and 13.9 m/s, inclusive, it satisfies the requirements.

    I tried to write out the algorithm description, but it went on and on an on. So, instead, here's a proof of concept Python code for the simplest variants: only ≤ rules (as the third rule is the same as the first one), no rules between unknowns, and no contradictory rules:
    Code:
    #!/usr/bin/python
    
    class Span:
    
        def __init__(self):
            self.min = float("-inf")
            self.max = float("+inf")
    
        def __str__(self):
            if self.min == self.max:
                return "%.1f" % self.min
            elif self.min < self.max:
                return "[ %.1f .. %.1f ]" % (self.min, self.max)
            else:
                return "No solution"
    
        def notgreaterthan(self, value):
            value = float(value)
            if value < self.max:
                self.max = value
                return True
            return False
    
        def notlessthan(self, value):
            value = float(value)
            if value > self.min:
                self.min = value
                return True
            return False
    
    notless = [ ( 'michael', 'michel' ), ( 'mikel', 'michael' ) ]
    known = { 'michel': 13.8, 'mikel': 13.9 }
    unknown = { 'michael' }
    
    solution = {}
    for name in unknown:
        solution[name] = Span()
    
    changes = True
    while changes:
        changes = False
    
        # Apply each rule to each tentative solution.
        # If there are any changes to the tentative solution,
        # set changes to True.
        for rule in notless:
            if (rule[0] in solution) and (rule[1] in known):
                if solution[rule[0]].notlessthan(known[rule[1]]):
                    changes = True
            elif (rule[1] in solution) and (rule[0] in known):
                if solution[rule[1]].notgreaterthan(known[rule[0]]):
                    changes = True
    
    for name in solution:
        print("%s = %s\n" % (name, solution[name]))
    Technically, the solver itself should be a separate class, having it written out like above is a no-no. Possibly the rules should be a separate class (a subclass of tuple), too.

    I'd hafta get a nap to let my subconscious munch on the issues, before I'd like to suggest the interface for the solver; that's why the above is just a raw'n'ugly proof-of-concept. (It could be that the solver would be easier/better if the entire problem set was treated as a set of equalities and inequalities instead, with the result being a set of sets of equalities and inequalities.) Also, it's Saturday, and I did have a couple of beers.

    For example, considering the type of the problem statements, each inequality or rule should be tested against the existing rules, so that the first contradictory rule stated raises an error.

    For more complicated rules, a simple span is not going to cut it; it'd have to be a set of spans and scalars. With ≤ ≥ < > -based rules, each unknown is limited to a half space, thus a continuous span (with < > comes the added problem of end points not being within the span, though); with ≠ and conditional rules, the span may be split into multiple spans.

    The nastiest cases to think of is when a span (or a set of spans) limits another span -- this happens when we have a rule that applies to two unknowns. I believe the correct option is to return the maximal set, so that the caller can fix any single variable within the spans specified, and obtain the subspace of the solutions by applying the solver again.

    Also note that I completely ignore information not relevant to the solution. (The problem statement used phrases like "X had speed Y during time interval Z", where the Z are completely irrelevant to the problem at hand.)

    I did like this problem -- even if I'm making a donkey out of myself -- because I can see it having some use case in the real world. Large collections of inequalities are nasty to manage in my opinion, and they do occur sometimes in the real world (underspecified problems), so I can see the benefit of having a tool that helps untangle them.
    Last edited by Nominal Animal; 09-12-2015 at 06:31 PM.

  8. #23
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    I won't be taking a look at the code right now, but that's essentially it. You nailed it. I didn't expect anything else from you.

    One of the most pernicious bugs you can have in a piece of software is the one where the code does exactly what you asked of it. It's not the code, but the solution to the problem that is wrong. Sometimes because the problem was misunderstood, other times because the solution doesn't actually answer the problem despite initial impressions. Tracking these bugs is perhaps the hardest of all bug tracking you can perform, outside bugs in deep multithreading structures.

    I deal with business and financial software, which is where a whole lot of exactly these problems arise more often, where the high precision requirements and the complex nature of the problems to be solved, along with the clients often inability to express their requirements in a precise language, make for a nasty cocktail for any analyst. Often you don't even know you have a bug. Values are produced, they happen to be the wrong ones, but you don't see it like that because the code passes all your tests. Test-driven development won't help alleviate it because you are bound to make the same wrong assumptions when building the tests. One of the reasons why the one building the tests should never be the one coding; but something that isn't a possibility in small teams.

    So these type of "questions without a solution" in an interview help me to have an inkling at a candidate ability to not make assumptions and detect problems even at the level of the problem description. They are mingled with regular questions and big points go to those candidates that question the validity of these questions and point to us we made a mistake. Zero points go to those that think they solved them.

    EDIT: You can use calculus to make this much, much simpler, Nominal. Anything comes to mind? A theorem, by any chance?...
    Last edited by Mario F.; 09-12-2015 at 06:53 PM.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  9. #24
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Quote Originally Posted by MutantJohn View Post
    Really? What did I do wrong?
    Your loop starts at zero not one.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  10. #25
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    Honestly, if that's all I did wrong, I'm pretty happy. It's a pretty trivial thing to fix/dwell on in the case of whiteboard pseudo-code.

  11. #26
    Registered User FourAngels's Avatar
    Join Date
    Aug 2015
    Location
    Canada
    Posts
    130
    Quote Originally Posted by telmo_d View Post
    I need to have the bigger picture in my head. I took a look at books of programming interviews and they focus a lot on algorithms and data structures. These concepts are one of the most important for a CS student? Is that knowledge used in the real world? Or they just ask that in programming interviews because they feel its good way to evaluate someone?
    That is the research and development side of CS. The fundamental algorithms are worth focusing the time and effort on, as well as searching and sorting algorithms. Advanced data types, not data structures (unless you mean class objects), but stuff like stacks, queues, lists, graphs, trees, is all fun to work with in programs. It is like having a repertoire for problem solving and being able to understand how systems level applications are organized. That is basic CS knowledge isn't it, not so much your familiarity with any specific software library or type of server package(s). You need that knowledge too, it is more than a one person job. I'm not sure if CS means that you have to know everything. It is more theoretical knowledge than administration work. For example, a CS student could try to write a software system, lets say a file system or a small database or a compiler or interpreter, or even something original. On the other hand a software developer is going to sell vendor software solutions and tie vendor systems together. They need partners to work at different ends because it is more like running a business, keeping up to date with changes, and supporting customers.
    Last edited by FourAngels; 09-13-2015 at 02:15 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++: What package should I learn to create real world programs?
    By DecoratorFawn82 in forum C++ Programming
    Replies: 0
    Last Post: 11-19-2013, 01:52 PM
  2. Replies: 2
    Last Post: 11-02-2011, 07:48 PM
  3. Replies: 1
    Last Post: 10-31-2011, 10:59 AM
  4. Programming concepts
    By lyx in forum C++ Programming
    Replies: 2
    Last Post: 12-03-2003, 12:37 AM