DEV Community

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

Collapse
 
oathkeeper profile image
Divyesh Parmar

So are those pagination simply stored like say Binary Tree, or like Stack like how PDFs work. BTW thanks for bringing up that infinite scrolling topic, I didn't know about it at all and was really curious all the time how does it work.

Wow you really explained super amazing I'm noting this all down in my OneNote, for the future knowledge whenever I get job and start working this is some dope shit I should be knowing

What is the cache process like? I know the word cache due to Computer Organization subject in sophomore year college. But how does it actually work in real world application (may be for a social media site, or is it like whenever, even if I don't have internet, i start chrome and it can load up all the sites I have visited so those must have been cached in browser's memory, right?)

Yeah I mean you really explained that there is no need of touching those DS & Algorithms things to touch, but what worried me is why is every company (may be especially here in India) always ask for DS & Algorithms problem solving questions in Interview?

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

THank you man! THanks a ton