S
S
Sergey K2016-03-14 09:15:51
Algorithms
Sergey K, 2016-03-14 09:15:51

Which link search algorithm to choose for a sitemap?

Hello!
On the current PHP project, there is work with a sitemap. The site map is in a file, a hierarchical structure, then a structure is filled in which has a parent and children. Everything would be fine, but searching for a link by ID takes a lot of iterations and a lot of time.
- Test (id: 100)
- - Test 3 (id: 10)
- Test 1 (id 80)
- - Test 4 (id: 1)
- - - Test 5 (id: 33)
Maximum nesting depth = 4.
I'm thinking implement using a B-tree. Who thinks what? Maybe there are other ways to speed up the search?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DarkMatter, 2016-03-14
@darkmatter

So there are duplicates? Can all levels be combined into a single-level array and searched in it?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question