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 308397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T07:38:48+00:00 2026-05-12T07:38:48+00:00

What is the optimal (easy to maintain, reasonably fast, robust) implementation of tree-like data

  • 0

What is the optimal (easy to maintain, reasonably fast, robust) implementation of tree-like data structure with three levels?
I would like to use Dictionary or SortedDictionary, because all values (nodes) have unique keys.

The first level is supposed to have about 300 items, every of these zero to tens (hardly more than 100, usually less than 10) items on second level and about ten on third level. Levels two and three are closely connected so they should be probably represented by a single object. All the relations are 1:n

++-L1
|++-L2
||+--L3
||+--...1 to 10 L3 items for each L2
||+--L3
|+--L2
|+--...0 to 100, usually <10 L2 items for each L1
|+--L2
+--L1
+--L1
+--...about 300 L1 items
+--L1

Is it better to create a dictionary in every 1st level object containing level2 objects (a real tree) or is it better to put all 2nd level objects into a single directory?

The objects are not very big, they contain only some strings and numbers. The application is supposed to be standalone (not needing any sql server or so)

Or is object representation a wrong choice and I should go for something totally different?

  • 1 1 Answer
  • 1 View
  • 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-05-12T07:38:48+00:00Added an answer on May 12, 2026 at 7:38 am

    Why not just make a TreeNode class?

    class TreeNode
    {
      private string _name;
      private int _someNumber;
      private int _uniqueId;
      private List<TreeNode> _childNodes;
    
      public string Name{get{return _name;}}
      public int SomeNumber{get{return _someNumber;}}
      public int UniqueId{get{return _uniqueId;}}
      public List<TreeNode> ChildNodes{get{return _childNodes;}}
    
      public void TreeNode(string name, int someNumber, int uniqueId)
      {
        _name=name;
        _someNumber=someNumber;
        _uniqueId = uniqueId;
        _childNodes = new List<TreeNode>();
      }
    
      public void AddNode(TreeNode node)
      {
        _childNodes.Add(node);
      }
    
      // other code for deleting, searching, etc.
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to structure a database for optimal use. But I have no
What would be the most optimal algorithm (performance-wise) to calculate the number of divisors
How much data should be in a table so that reading is optimal? Assuming
What are optimal settings for Recycling of Application Pools in IIS7 in a shared
What do you find is the optimal setting for mysql slow query log parameter,
I'm just wondering what the optimal solution is here. Say I have a normalized
I am trying to find an optimal solution for the following problem: there is
Has anyone else found VIM's syntax highlighting of Javascript sub-optimal? I'm finding that sometimes
I realize that parameterized SQL queries is the optimal way to sanitize user input
The CSS syntax highlighting in vim is not entirely optimal. For example: div.special_class stops

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.