r/learnprogramming • • Mar 24 '18

I would like to share 500 Data Structure and Algorithms problems

You can find around 500+ data structure and algorithms problems here that are helpful to improve your algorithmic skills and also to crack coding interview of top tech companies.

Here's another link that filters problems that are solved using STL.

Hope this helps.

2.3k Upvotes

96 comments sorted by

54

u/[deleted] Mar 24 '18

Dude I think about how I need to study data structures and algorithms and then this post shows up. Thank you so much OP.

40

u/[deleted] Mar 24 '18

Thanks

35

u/serianx Mar 24 '18 edited Mar 24 '18

I'm also working on a repo full of algorithms solved in many languages (including python, javascript, ruby, go, julia, etc). If you feel like contributing please join us on github! link

7

u/darthyodaX Mar 24 '18

This is awesome! I’ll try to contribute C/C++ when I can. Thanks for sharing this.

2

u/serianx Mar 24 '18

That'd be awesome!

-33

u/Xeverous Mar 24 '18

Please don't contribute C/C++ abonimation. Write either proper C or C++. Mixing both is bad

8

u/yoctometric Mar 24 '18

I think they might have meant C or C++. I dunno I’m super beginner

2

u/Xeverous Mar 25 '18

Usually yes, and it should be written this way. These are 2 different languages, the only valid terms for "C/C++" would be compability and community. Speaking "C/C++" as 1 language is just ignorance of people who do not know differences

3

u/YoloIsuppose Mar 25 '18

I don't know if you know it but there's this one already which is pretty big, maybe consider contributing to it instead?

2

u/shingtaklam1324 Mar 25 '18

I'll try and do some in Rust when I'm free

1

u/serianx Mar 25 '18

d do some in Rust when I'm free

That'd be awesome, thanks!

1

u/shingtaklam1324 Mar 25 '18

Actually, giving it some more thought, I think it may be easier to have the Rust ones in a separate repo with the way that Cargo integrates into the build process

1

u/[deleted] Mar 25 '18

I have some old Java algos when I was in uni. I will add them when I'm free.

11

u/Rafat_lne Mar 24 '18

wow, I like how every problem has own visual solution. I don't have to go another website to understand those problems.

Can you add some math related algorithms/problems?

edit: typo

7

u/shiprian Mar 24 '18

Not crashed . Just a feature called error connecting to database. We are all programmers here.

6

u/GustavDitters Mar 24 '18

If I can solve all of these will I get a job?

10

u/serianx Mar 24 '18

you will get a job long before you finish them all

-6

u/Iggyhopper Mar 24 '18

Logically, I will get a job if I finish one and not all.

So I finished one, where is my job?!

6

u/persiepanthercat Mar 24 '18

I have a midterm in a week and a half on this and you might have just helped me get a better grade.

16

u/[deleted] Mar 24 '18

Error establishing a database connection

Also, implementations in C and Java aren't that useful because they're not all that different. F# or Python and Java would be more reasonable or so.

7

u/darthyodaX Mar 24 '18 edited Mar 24 '18

u/serianx shared a repo that has Python and more. Here the link to his repo. link

2

u/[deleted] Mar 24 '18

That's a link to a non-existent subreddit.

1

u/darthyodaX Mar 24 '18

Haha my mistake. I think it should work now.

1

u/monsto Mar 24 '18

Java and Javascript would be funnier.

1

u/Xeverous Mar 25 '18

Neither implementations in C++. They are almost straight-copied C. Writers make a feeling that C++ does not have standard library

5

u/kaysersozzee Mar 24 '18

Thank you so much

4

u/Snow75 Mar 24 '18

Thanks a lot, I’m a teacher and this will be very useful

3

u/[deleted] Mar 24 '18

Remind me to visit this after reddit hug of death

3

u/The_Larger_Fish Mar 24 '18

I've been working through all these! I've done about a hundred so far and find them really helpful. There isn't actually 500 unique problems. For example, the binary tree problems shares a lot of questions with stacks and queues. But they're still good questions!

3

u/M3jsh Mar 25 '18

Man, I wish resources like these existed back in my college days.

5

u/EngineerKE Mar 24 '18

God bless ye

5

u/iamagupta Mar 24 '18

Saved, upvoted, was gonna give gold but too bad I don't have a job right now.

6

u/wawnow Mar 24 '18

I got 99 problems now this ain't one

7

u/thesilvermoose Mar 24 '18

Even better; now you have 500 problems

2

u/Thinkernet Mar 24 '18

Thank you!

2

u/rad8329 Mar 24 '18

Thanks!!

2

u/lmvsp Mar 24 '18

Thanks a ton.

2

u/[deleted] Mar 24 '18

Holy crap this site is awesome, thanks a lot!

2

u/prakrieti Mar 24 '18

Good problems, definitely gonna help the students for the tech Interview! I hope to try most of them. I like the trie section.

2

u/petak5 Mar 24 '18

Looks like your database server is down: Error establishing a database connection

2

u/[deleted] Mar 24 '18

Wow

2

u/parion Mar 24 '18

Thanks man! I have an interview on Thursday and it's been years since I did any data structures and algorithms problems. This will be a good refresher, thanks!

2

u/WillFireat Mar 24 '18

Thanks. This is exactly what I need right now in my life, more problems :p

2

u/infrared305 Mar 24 '18

You win the internet.

2

u/knapseck Mar 24 '18

Nice stuffs

2

u/_maruf Mar 24 '18

Error in Database connection

2

u/parrot_in_hell Mar 24 '18

Error establishing a database connection :(

2

u/Notoriouskhan Mar 24 '18

big thanks to you dude (Y)

2

u/recioui Mar 24 '18

thanks man

2

u/anasrchid Mar 24 '18

i was thinking about solving some exercises and then this post showed up, THANKS!

2

u/[deleted] Mar 24 '18

Thank you!

2

u/[deleted] Mar 25 '18

Thank you

2

u/[deleted] Mar 25 '18

"Yea I'm into programming as a hobby in my spare time."

> see websites like this with algorithms on them

"Fuck I have no idea where I'd even begin to tackle that problem."

Seriously, I feel like a pretty competent programmer, but I have no idea how I would go about getting anything done in a professional setting.

3

u/fisnikhaj Mar 24 '18

Error establishing a database connection

2

u/[deleted] Mar 24 '18

Thks

2

u/[deleted] Mar 24 '18

Site crashed?

2

u/disdi89 Mar 24 '18

Getting error for the firslt link " Error establishing a database connection"

1

u/Rafat_lne Mar 24 '18

wow, I like how every problem has own visual solution. I don't have to go another website to understand those problems. Can add some math related algorithms/problems?

1

u/felangel1 Mar 24 '18

Not working for me either

1

u/gigastack Mar 24 '18

Instead of an algorithm problem, I get a resources problem - can’t establish a connection to the database. Looking forward to checking this out in the future though.

1

u/red_devil071997 Mar 24 '18

Database error

edit: Its working now

1

u/[deleted] Mar 24 '18

Kaput

1

u/[deleted] Mar 24 '18

RIP OP's link

1

u/Witchtripper86 Mar 26 '18

Just signed up to say; thank you!

1

u/geek_007 Aug 16 '18

Dynamic Programming:

Graphs:

1

u/geek_007 Aug 16 '18

Heap:

Linked List:

Matrix:

1

u/geek_007 Aug 16 '18

Stack:

Queue:

String:

1

u/geek_007 Aug 16 '18 edited Aug 16 '18

Binary:

Trie:

Puzzles:

1

u/geek_007 Aug 16 '18

Binary Tree:

BST:

1

u/geek_007 Aug 16 '18

Binary Tree:

BST:

1

u/geek_007 Aug 16 '18 edited Aug 16 '18

Backtracking:

Sorting:

Divide & Conquer:

Greedy:

1

u/geek_007 Aug 16 '18

Binary Tree:

BST:

1

u/geek_007 Aug 16 '18

Array:

1

u/geek_007 Aug 16 '18

Array

1

u/untraiined Mar 25 '18

is there anything there that cant be found on leetcode?

0

u/b_curious Mar 25 '18

There are already thousands of resources for finding such problems, what's new? it would be better if there were some cohorts to help each other and motivation within group. I have tried to create such group but hardly got any traction, its sad that such posts receive such high votes.

-1

u/Xeverous Mar 24 '18 edited Mar 24 '18

The C++ implementation of KMP algorithm (link) does not compile (array size is not compile time). Algorithm is implemented very poorly (unnecessary memory allocations and copies and no iterators). This looks like someone copy-pasted C solution, added misused standard string and called it "C++". The writer did not knew STL

0

u/[deleted] Mar 24 '18

[deleted]

10

u/PathToTheLight Mar 24 '18

8 hours later still down, smh

16

u/ScrumptuousLick Mar 25 '18 edited Mar 25 '18

How to royally fuck a website;

1: copy url of site. 2: post in relevant subreddit 3: ? 4: profit.

14

u/im_not_afraid Mar 25 '18

How to royally fuck a list;

1: make list 2: don't put double spaces to make newlines 3: use old ??? profit meme 4: ??? 5: profit

6

u/ScrumptuousLick Mar 25 '18

PRECISELY, you business tycoon, you.

3

u/WebNChill Mar 25 '18

Place monero miner on said website...profit

2

u/[deleted] Mar 25 '18

12 hours later still down, smdh

3

u/im_not_afraid Mar 25 '18

that's the 500+ plus 1th challenge problem.

0

u/[deleted] Mar 24 '18

[deleted]

12

u/Gigazwiebel Mar 24 '18

Link works, links in the link don't =(

0

u/[deleted] Mar 24 '18

[deleted]

2

u/SweetOnionTea Mar 24 '18

Nah, but understanding why a particular algorithm is faster or coming up with your own solutions may be difficult without some math or cs background. I would check out a course in discrete math to get a good background to analyze algorithms.

1

u/[deleted] Mar 25 '18

Sometimes knowing the right algorithm IS the solution.