DEV Community

Algorithms and Data Structures in JavaScript

Oleksii Trekhleb on May 30, 2018

Hello Readers! I’ve recently launched JavaScript Algorithms and Data Structures repository on GitHub with a collection of classic algorithms and da...
Collapse
 
tifflabs profile image
tiff

THIS THIS THIS THIS THIS. Google recruiter reached out to me the other day. We had a conversation and he wants me to be ready for the interview by studying this stuff. The materials he sent honestly. This is going to help me so much. Thank you!

Collapse
 
isaacleimgruber profile image
IsaacLeimgruber • Edited

Hey if you got to learn this maybe you might want to consider studying the complexity of a piece of code containing for example multiple for-loops or recursion

Collapse
 
isaacleimgruber profile image
IsaacLeimgruber

O (n2) is not horrible. If you problem is matrix multiplication, the you're a god if you do it in O (n2). The complexity is relative to the problem. Also, time complexity should be considered together with space complexity. If you can sort in O(n) time wih O(n2) it might be not that good, but it depends on the size of your data. For small data you can afford to store O(n2). A good complexity table is the one of "data structure complexity in c++" which compares operation for different data structs

Collapse
 
frosnerd profile image
Frank Rosner • Edited

Hi Isaac,

I think the chart was taken from bigocheatsheet.com/ and there it mainly talks about data structure operations (read, insert, update, delete) and sorting algorithms.

I agree with you that to say a complexity is bad cannot be done independently of the problem.

Collapse
 
isaacleimgruber profile image
IsaacLeimgruber

Yeah exactly thats the cheatsheet I had in mind :)

Collapse
 
elkhan profile image
Elkhan • Edited

Has anyone tried online courses like this one udemy.com/coding-interview-bootcam... ?
There is Frontend Masters' course frontendmasters.com/courses/data-s... but it's so irritatingly wordy. I like concise and to the point way of teaching.
P.S. You all are probably aware of this repo but in case or for future references - github.com/getify/You-Dont-Know-JS

Collapse
 
frosnerd profile image
Frank Rosner

Hi Oleksii!

Thanks for sharing. Where'd you get the image from? It looks a lot like the one on bigocheatsheet.com/ but it's missing the "excellent" part in the graph, although it's present in the legend.

Collapse
 
stephjs profile image
Steph

Cooooool! I wrote a post on Linear and Binary Search. I'd love to get your feedback, Oleksii. :)

Collapse
 
javila35 profile image
Joe Avila

Seriously, thank you!

Collapse
 
jess profile image
Jess Lee

Wow, this is awesome!

Collapse
 
jamesthemullet profile image
James Winfield

5 years later...thanks for doing this, was an interesting introduction to data structures from a perspective of someone who kind of needs to backfill my knowledge!

Collapse
 
xdaizu profile image
Danny • Edited

Conclusion: In CS, no algorithm is "excellent".

- Not even O(1)?
+ No
- That's not fair!
+ No, there are not "fair" algorithms, either.

Collapse
 
artyom profile image
Artyom Yakovenko

This is so awesome! Thanks!

Collapse
 
vishnumeera profile image
VishnuSankar

Thank
You
Soooo
Muchhh....😀😀😃

Collapse
 
berns_churches profile image
Berns Fire Death

This is so sick! Thank you so much for this. I wonder if we could do this for typescript?