Thread: QuadTree: Should Non-Leaf Nodes Contain Points?

  1. #1
    Registered User IdioticCreation's Avatar
    Join Date
    Nov 2006
    Location
    Lurking about
    Posts
    229

    QuadTree: Should Non-Leaf Nodes Contain Points?

    Hi CBoard,

    I'm implementing a quad tree for an assignment, and I'm not sure if every node should contain a list of pointers to every Point in its sub tree (implying the root node will contain all Points), or if only leaf nodes should contain the Points.

    I have a feeling it won't really matter much, but I'm curious how it is typically done.

    Thanks!

  2. #2
    Registered User
    Join Date
    Aug 2010
    Location
    Poland
    Posts
    733
    What are the main reasons to use a quadtree?
    If you answer this question, you should also be able to answer yours.

  3. #3
    Registered User IdioticCreation's Avatar
    Join Date
    Nov 2006
    Location
    Lurking about
    Posts
    229
    Quote Originally Posted by kmdv View Post
    What are the main reasons to use a quadtree?
    If you answer this question, you should also be able to answer yours.
    Well my first thought is no, they shouldn't. Because it adds extra bulk to each node. But wouldn't having them there make range queries much faster because you wouldn't need to traverse down to the leaves to get all the points within a larger range.

    So, I guess right now, both ways make sense to me. But I want to know if I'm missing something. Is it acceptable to implement it either way? Are there any major drawbacks?

    Thanks

  4. #4
    Registered User
    Join Date
    Aug 2010
    Location
    Poland
    Posts
    733
    Quote Originally Posted by IdioticCreation View Post
    Are there any major drawbacks?
    Yes, it misses its primary point - optimisation for amount of memory occupied.

  5. #5
    Registered User IdioticCreation's Avatar
    Join Date
    Nov 2006
    Location
    Lurking about
    Posts
    229
    Quote Originally Posted by kmdv View Post
    Yes, it misses its primary point - optimisation for amount of memory occupied.
    OK, I get it. I guess I just underestimate how much memory a list of pointers could take.

    Thanks for the help!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Distance between root and leaf.
    By peripatein in forum C Programming
    Replies: 14
    Last Post: 06-20-2013, 12:36 PM
  2. C++ Plot Simple Points / Graph, X & Y array points
    By Khadafi in forum C++ Programming
    Replies: 9
    Last Post: 11-11-2011, 03:47 AM
  3. HELP! :linked list from tree leaf nodes
    By ayman88 in forum C Programming
    Replies: 2
    Last Post: 03-01-2010, 12:19 AM
  4. building a linked list from tree leaf nodes
    By ayman88 in forum C Programming
    Replies: 0
    Last Post: 02-27-2010, 04:24 PM