Answer the question
In order to leave comments, you need to log in
How to apply search trees in real projects?
I study in absentia, at the last session they introduced the subject of SAOD, talked about trees, lists, stacks. If everything is clear with the latter, then everything is not so simple with trees.
So, we were given an introductory course, given a training manual and a couple of labs, everything was handed over and at the end they were given a coursework: we need to make a small database (sorting, searching), using the acquired knowledge to the maximum. But here's the problem: they explained everything to us in numbers, but I have few ideas on how to apply this in a real project. How to use a tree to store and retrieve the same strings? What will be the keys, how to determine the weight in this case?
Tell me where to read about it? All I find are lectures from different universities, which, like my training manual, only give a superficial idea ...
Answer the question
In order to leave comments, you need to log in
Search trees are good because they allow you to quickly perform all the basic operations: search, insertion, deletion. There are many different trees: AVL , red-black , various variations of B-trees and many others .
If we store some related data in the database (i.e., records consisting of several values, possibly of different types), then we can select one of these values (which more or less uniquely characterizes the record, or we will often refer to to this entry by this value) as a key. Thus, knowing the key, the user of our database will be able to quickly get all the data associated with it.
I won’t tell you the details of the database architecture and the structures used (and they probably use the achievements of science that are not covered in university courses), but I can say the following:
en.wikipedia.org/wiki/B-Tree
has a picture there, it explains everything. or look for b-tree or database index in Russian.
Buy Cormen, you won't regret it.
www.ozon.ru/context/detail/id/2429691/
In fact, trees are used not only for strings, for example, in geometry, you often can’t get anywhere without them. Look at kd-tree for nearest points or octree for volume representation.
So you are looking not by rows but by tree indexes. Usually in labs this is implied, and not full-text search.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question