
Data structures and algorithms practice problems and their solutions - abhimt
https://medium.com/@kingrayhan/500-data-structures-and-algorithms-practice-problems-and-their-solutions-b45a83d803f0
======
Radle
This was already posted under a different link.

[https://techiedelight.quora.com/500-Data-Structures-and-
Algo...](https://techiedelight.quora.com/500-Data-Structures-and-Algorithms-
practice-problems-and-their-
solutions?__filter__&__nsrc__=2&__snid3__=1594232728&amp;share=1#)

In fact it seems as the author on Medium "forgot" to mention his sources.

------
danieltillett
As scientist (Molecular Biology background) who has transitioned to being a
part-time self-employed developer, how often do you CS/CE people use any of
this in real life? Is all this just equivalent to the Chinese imperial civil
service examination system [0]?

0\.
[https://en.wikipedia.org/wiki/Imperial_examination](https://en.wikipedia.org/wiki/Imperial_examination)

~~~
lkozma
This is a valid criticism from a practitioner point of view. From someone
doing research in algorithms and data structures or someone just curious about
it at an intellectual level, there is a different criticism:

All this focus on algorithms for the sake of interview-preparation gives the
false impression that the field is a closed body of work. In reality it is an
active and lively field of research with many (even most) basic questions not
yet understood.

Someone could go through these 500 questions and for (almost) all of them
formulate variants/extensions that would be open research questions. So
instead of memorizing them, ask for each: Is this the best possible solution?
Can I prove it? What if I restrict what the algorithm can do? What if I give
the algorithm extra powers? What if the data comes online? What if the input
is noisy? What if I want to optimize space usage instead of time? Is there a
trade-off between the two? Etc. etc.

And related to the parent question: does the problem model a real practical
problem? Why not? Can the model be changed to be more realistic?

All that being said, at a first look, the list seems like a quite nice
collection of techniques.

~~~
danieltillett
My post wasn’t intended to be a criticism - I was genuinely interested to know
the answer.

I work on what are considered hard CS problems and I rarely find the difficult
part is knowing some data structure or algorithm, but in finding a way of
translating real world problems into something that makes sense in code.

~~~
thisisit
I am not sure of your study of problems but you have spoken like techno-
functional user. Finding a good translation surely is a big part but then
getting things correct is also required. Writing couple of joins to get the
correct data is fine but getting the correct join or data type or structure is
also required. The difference being running a code for couple of hours vs in
couple of minutes.

~~~
danieltillett
I am not suggesting that the right data structure is not important, just that
is not where the difficulty lies. I can solve problems that my far more CS
knowledgable employees can't because I have a better understanding of the
domain. My solutions are not always the most elegant, but they work (most of
the time).

~~~
thisisit
My point is on the elegance of a solution. As you said your solution works but
that can be attributed to your domain knowledge. But the affect of your
solution might be understated. We have people who write direct queries after
much discussion with us. While we can't directly point them out, the queries
tend to run for hours affecting other people's work and then we have to rework
the whole thing all over again.

------
anameaname
Some of these answers are not great, and wouldn't stand up to interview
scrutiny. For example, the "Check if linked list is palindrome or not" problem
says copying the list would be too expensive. The proposed answer (recursion)
some how avoids this.

The solution is technically right, but it's making a copy of the list too. The
intuition is wrong.

------
keriati1
I work as a developer in enterprise environment since 4 years. So far I didn't
encounter any of the above issues. However we have a set of other issues
mostly connected to maintainability of a code base or refactoring of legacy
code. I would love to see a set of interview questions that target our issues
too.

(Our best approach so far was to test people with the gilded rose kata and see
how they manage the problem without reimplementing it from scratch)

------
ourmandave
A list of only 500 potential problems for an interview.

All right class, remember to read the textbook cover-to-cover over the
weekend, as your first quiz may, or may not, cover the entire course.

But don't be nervous, it's only worth 95% of your grade.

------
r0f1
Soo... let's create a github repo and solve all these? :D

~~~
fit2rule
Cool idea!

