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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:47:25+00:00 2026-05-14T05:47:25+00:00

I have about 200 categories that are nested. I am currently reading the documention

  • 0

I have about 200 categories that are nested. I am currently reading the documention on the C5 generics library. I am not sure if the C5 library is overkill or not. I am looking at converting all my custom algorithms to the C5 implemention.

This is what I need. If a certain category is chosen i need to find its parents, siblings, direct children, and all children.

This is the way I have it set up. To find the:

Parents:
I start from the current location then loop through the list and find the current parent. When I find the parent I loop through the whole list again to find the next parent and so on.

Siblings:
I loop through the whole list and find all the nodes that have the same parent as the choosen node.

direct children:
I loop through the whole list and find all nodes that is a parent of the choosen node.

All Children:
This one took me a while to figure out. But I used recursion to find all children of the choosen node.

Is there a better way to implement something like this?

  • 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-05-14T05:47:26+00:00Added an answer on May 14, 2026 at 5:47 am

    Why does it have to be collection-based? I would just create class Category with properties Category Parent and IList<Category> Children. That way, finding parent or predecessors is really easy (and fast!), finding children too, siblings are children of parent except the current category, so they are easy too. And finding descendants is trivial recursion.

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

Sidebar

Related Questions

I have about 200 Excel files that are in standard Excel 2003 format. I
I have a CSV file that holds about 200,000 - 300,000 records. Most of
I have a Postgres instance building a GIN index. It's looking at about 200,000
I have about 200,000 text files that are placed in a bz2 file. The
I have a Grid Panel that loads about 200 records from the server. I
I have a table in my database that has about 200 rows of data
I have a huge string of raw text that is about 200,000 words long.
I have got about 200 word documents that I need to pdf. Obviously, I
Well it's not playing actually. I have a database with about 200 list of
I have about 200,000 thumbs in a folder that are all gzipped ending with

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.