Like Tree1Likes
  • 1 Post By whiteflags

which the best way to store duplicate data in tree (maybe tree data structure)?

This is a discussion on which the best way to store duplicate data in tree (maybe tree data structure)? within the General Discussions forums, part of the Community Boards category; Hi all. I've a file and have parsed them into tree structure. I've used dictionary (key-value pair data type) to ...

  1. #1
    Registered User
    Join Date
    Dec 2011
    Posts
    7

    Question which the best way to store duplicate data in tree (maybe tree data structure)?

    Hi all.

    I've a file and have parsed them into tree structure. I've used dictionary (key-value pair data type) to store the tree. But, I've a problem when another sibling has same name but different of value is exist on tree. Which is the best way to store this tree?

    Thank you.

    Best regards.

  2. #2
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,689
    Attach each value of a certain key to a linked list. Essentially each node in the tree is a head of a list. Your data structure will spend a little more time on average looking for the right value but there are optimizations for that too. One such optimization is simple, move the last value you used to the front of the list. This will organize the list so that the most used values are retrieved in fewer moves.
    Last edited by whiteflags; 03-29-2013 at 11:47 PM.
    manasij7479 likes this.

  3. #3
    Registered User
    Join Date
    Dec 2011
    Posts
    7
    Thank you whiteflag, I'll learn more about linked list to imagine that is it suitable for my problem? Thank you

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. List Tree - New data structure
    By sincoder in forum C++ Programming
    Replies: 5
    Last Post: 08-12-2008, 01:33 PM
  2. no tree data structure in STL
    By manav in forum C++ Programming
    Replies: 2
    Last Post: 01-11-2008, 12:23 AM
  3. Accessing a quad tree data structure
    By JFonseka in forum C Programming
    Replies: 8
    Last Post: 10-25-2007, 12:56 AM
  4. can't insert data into my B-Tree class structure
    By daluu in forum C++ Programming
    Replies: 0
    Last Post: 12-05-2002, 05:03 PM
  5. C++ Data structure Tree
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 10-23-2001, 10:14 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21