I am find it hard to implement data structures in real life

Hello guys and ladies out there. I am really struggling to get the concept around data structures in the real world. The reason for that is in life of developing with data I just query data from database and it just return a small set data which I purpose you wouldn’t expect me to even use data structure algorithm on it or you propose query all my data and start to use something like binary tree on them which I think is not really a thing to even think about. so now you see were I am coming from what are the real world cases to use data structures. Thank you, I have blessed day

Hello @Rauf_Alhassan ,
binary tree is used in database Indices; when you index a field, it is put in a binary tree for fast retrieval and routing tables in networking for routers that need to be really fast…

I’ve never had to implement a binary tree “in real life”. I do work with objects and arrays a lot, which are data structures. Handling those effectively and efficiently is important for my work.

1 Like

You’re looking at things at the wrong level of abstraction. As @ArielLeslie says objects and arrays (which are also objects) are data structures. They themselves are implemented using data structures in the underlying language (if C, then the algorithm for them uses simple C arrays or hash maps depending on what the object contains afaik). Those are in turn implementations of other algorithms/structures &c.

With what you’re talking about, the database itself will be implemented using a tree data structure of some kind (B-Trees I think are most common, I am in no way an expert on data structures though so this is just a pretty meaningless fact to me). You are unlikely to need to implement some similar structure after getting the data from the database in the normal course of things: the database has already implemented this for you. Whereas if you were writing a database, sure. Or doing something equally low level where you don’t just get structures out of the box (graphics programming for example).