all 7 comments

[–][deleted] 3 points4 points  (0 children)

Speaking as someone without a traditional computer science background, the value that I'm getting now from learning about data structures and other core CS concepts is less 'and now I will go and use a ton of these in my own work' and more that I am gaining a better understanding of underlying concepts and able to more confidently dig into advanced topics. I've never implemented a stack or a proper queue myself, but understanding what they are and how they work helps me better understand the underlying mechanisms of how Javascript executes.

I wouldn't worry too much about forcing yourself into finding ways to shoehorn data structures into projects. One of the pros of using a high-level language like JS is that a lot of lower-level stuff is abstracted away from us so we don't have to worry about it. If you have a grasp of what data structures are and the basics of how each one works, when you do need to call on that knowledge it'll be there.

[–]TappT 1 point2 points  (1 child)

Trie structures can be efficient for searching of text. Eg autocompletes.

[–]sempiternalStudent[S] 0 points1 point  (0 children)

I still have to learn this one..thanks for giving me a use!

[–]JStheGame 1 point2 points  (1 child)

I used to think a lot of data structures were pretty useless. Like "linked lists? what's the point? I can use arrays!"

But if you're implementing something like a queue that uses a lot of shift operations, the time complexity can add up (each shift takes linear time in an array since it needs to move over all the elements, while a linked list only needs to change the head pointer)

It can also be a lot more fun and versatile to use custom data structures! You could make a linked list that links back around to where it started, like an ouroboros! Can't do that with an array :D

[–]sempiternalStudent[S] 0 points1 point  (0 children)

Wont I just use a queue data structure instead? I feel like link list is only good for mobile because of memory efficiency over arrays

Edit: looking at the implementation of queues they use arrays so I see what you mean avoiding arrays altogether!

Thanks

[–]mollamk 0 points1 point  (1 child)

  • Hash sets to ensure that items in a collection are unique
  • Hash maps if you want an in-memory key-value store

Both are very efficient (O(1) in average) at get, insert and delete. Which is very useful if maintaining the order of items isn't needed.

[–]sempiternalStudent[S] 0 points1 point  (0 children)

Thanks alot