DEV Community

Discussion on: How can We implement Data Structures and Algorithms in Backend Frameworks to reach O(log(n)) Run Time ?

Collapse
rhymes profile image
rhymes

Database pagination is an abstraction on the traversing a data structure, in this case it's done inside the database but you can create a paginator on an array for example. Pagination means dividing the results in "pages" of the same size and using an offset to move the cursor.

DBMSs are very complex structures, I'm quite sure they don't use a single data structure, but many. If you really want to dig in the insides of a DMBS you could start with an overview of how one of them phisically stores data: Introduction to PostgreSQL physical storage

A cache in a real word application is not very different from the concept of cache in general. The purpose of a cache is to be a temporary store of information that is expensive to compute. You have caches in the CPU, you have caches in the database, you can have caches in your program, you can have caching at the HTTP level. They all do, in different ways, the same thing: return data instead of going to the source to recompute it.

Browsers have caches too, some sites employ offline caching so to be partially usable even without connection.

Anyway I didn't say you don't need to know about data structures and algorithms, you do. I'm saying there's no point into replicating the functionality of the database in your code. The reason why companies ask them of you is because they are useful in designing programs and algorithms. It's just that they might not in your particular example: extracting data from the database in Django.

Still, you need to know in general how a database works and yes, sometimes, about caching too.

Good luck with your learning!

Thread Thread
oathkeeper profile image
Divyesh Parmar Author

THank you man! THanks a ton