We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Hey @d_kokarev thanks for the input. I've looked at Fenwick trees and seem like the way to go. But I still have a hard time between the mapping of the Tree/Graph nodes, and the Fenwick tree indexes.
The strategy lies in the DFS tree representation, where all children lay sequentially
I assume you refer here to the array so called "edgeTo" which contains the information encoded after a DFS or BFS is done in a Tree/Graph of the connections between the nodes.
I'm still a a loss as I mntioned in the mapping. Do you have any pointers on that? I would appreciate any help. Thanks in advance
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Join us
Create a HackerRank account
Be part of a 26 million-strong community of developers
Please signup or login in order to view this challenge
Lazy White Falcon
You are viewing a single comment's thread. Return to all comments →
Hey @d_kokarev thanks for the input. I've looked at Fenwick trees and seem like the way to go. But I still have a hard time between the mapping of the Tree/Graph nodes, and the Fenwick tree indexes.
I assume you refer here to the array so called "edgeTo" which contains the information encoded after a DFS or BFS is done in a Tree/Graph of the connections between the nodes. I'm still a a loss as I mntioned in the mapping. Do you have any pointers on that? I would appreciate any help. Thanks in advance