Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8136701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:50:34+00:00 2026-06-06T10:50:34+00:00

Which is the most suitable tree data structure to model a hierarchical (containment relationship)

  • 0

Which is the most suitable tree data structure to model a hierarchical (containment relationship) content. My language is bit informal as I don’t have much theoretical background on these

  1. Parent node can have multiple children.
  2. Unique parent
  3. Tree structure is rarely changed, os it is ok to recreate than add/rearrange nodes.
  4. Two way traversal
  5. mainly interested in, find parent, find children, find a node with a unique id
  6. Every node has a unique id
  7. There might be only hundreds of nodes in total, so performance may not be big influence
  8. Persistence may be good to have, but not necessary as I plan to use it in memory after reading the data from DB.

My language of choice is go (golang), so available libraries are limited. Please give a recommendation without considering the language which best fit the above requirement.

http://godashboard.appspot.com/ lists some of the available tree libraries. Not sure about the quality and how active they are. I read god about

  1. https://github.com/petar/GoLLRB
  2. http://www.stathat.com/src/treap

Please let know any additional information required.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T10:50:35+00:00Added an answer on June 6, 2026 at 10:50 am

    Since there are only hundreds of nodes, just make the structure the same as you have described.

    • Each node has a unique reference to parent node.
    • Each node has a list of child node.
    • Each node has an id
    • There is a (external) map from id –> node. May not even necessary.

    2 way traversal is possible, since parent and child nodes are know. Same for find parent and find child.
    Find id can be done by traverse the whole tree, if no map. Or you can use the map to quickly find the node.

    Add node is easy, since there is a list in each node. Rearrange is also easy, since you can just freely add/remove from list of child nodes and reassign the parent node.

    I’m answering this question from a language-agnostic aspect. This is a tree structure without any limit, so implementation is not that popular.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Which data structure is most suitable for forward and backward webpage traversal in web
which language most suitable for working with cookies and inner page structure with ajax?
I have been reading about tree data structure to model a problem. I need
I have tabled data in which most of the cells are text inputs or
I am developing a webapp which the most challenging aspect is the 3D model
Which DBMS is most suitable for a MMORPG game server?
Does anybody know which JSF version is most suitable to use when deploying to
Which web browser is most suitable for web development? To be precise which browser
My site lets people create database entries (which most rails apps do), and I
I'm developing a custom control, which most resembles a text area. I am drawing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.