I know, just a class version of the C-array but std::vectors has lower performance. I believe that std::array or C array are good enough for problems with non-dynamic input.
Using std::array is writing code C++ way. If you know size of the array compile time and you know it will fit the stack then there is no reason to use std::vector.
This graph is based on influence relation data from the now defunct Freebase, which combined various data sources including Wikipedia. Gephi was used for the graph layout, node sizing and coloring and Sigma.js is used for rendering in the browser.
>Does anyone really ask you to write this kind of code in interviews
Whoh!! All big IT companies ask these type of questions.. but mostly to graduate students and less experienced candidates.. but some companies might ask it to a 10 year old programmer as well..
> All big IT companies ask these type of questions.
Careful with absolutes. Although I used the word "any" in my post so I guess I shouldn't talk.
Having worked at some large tech companies I can say definitely it is not "all"
Some of these examples are 90+ lines of code which is why I ask. It would not be unrealistic with that much code that candidate will be sitting in the interview room for a half hour+ coding just one question.
Several of these are borderline trick questions or only test your ability to memorize. For example, I learned Dijkstra’s algorithm in school 10+ years ago but if you were to ask me to implement it without reading the algorithm I wouldn't be able to.
Asking graph data structure questions, sure. But here are more effective ways to know if a candidate will be a good fit than asking them to implement one of these.
Use these as your interview test questions and all you are testing is the ability for the candidate to regurgitate algorithms. None of these test creative problem solving.
The thing about Dijkstra's algorithm is that it't just the obvious one that you would think of if you had never been introduced to the problem before. I'm pretty sure I "invented" it myself at least twice, and then forgot it.
Kudos to Dijkstra for nailing it down, but I think we do students a disservice by invoking his name all the time, thus making it seem scary.
True. This is what I meant by confusing, without properly defining the variables at play, in this context, k is the index of the element of the ordered list, and not the kth smallest element.