<br><br><div class="gmail_quote">On Mon, Apr 28, 2008 at 10:32 PM, Paul Harris &lt;<a href="mailto:paulharris@computer.org">paulharris@computer.org</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br><div class="gmail_quote"><br><div>if that is the extent of your data, then it would just use copies inside the kdtree instead of pointers.<br><br>i use pointers when i need to find an item, and then refer back to where it was originally in the vector... or if there was a *lot* of data in each point.<br>

</div></div></blockquote><div><br>Yeh ... you could really do it either way. My application will be using some structs that are points in space with associated data, and will be &quot;indexing&quot; them for lookup not only by their x,y coordinates but also by the other data, so I need to put them (or references to them) into several different types of maps (hash table, kdtree, etc.) depending on how I am looking them up. <br>
<br>It has long been a habit of mine, when I have an issue of this type, to create a single datum and to reference it through pointers that I pass around the app. As long as I am careful about who owns the memory and when it is still &quot;live&quot; then everything is fine. This is not the only way to write programs but as I said it has long been a habit of mine to avoid duplication of data, not for reasons of conserving memory but to make the code easier to organize. So I like to do it that way for my personal reasons.<br>
<br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="gmail_quote"><div><br></div><div><br>go for it</div></div></blockquote>
<div><br>I went for it, and I now have a toy app that&nbsp; stuffs a kdtree with pointers to a&nbsp; &quot;singlet&quot; (an object storing only one&nbsp; scalar datum!)&nbsp; and does the basic find stuff on it. If anyone is interested I will send it to the ng and it can perhaps be another example. We could use more. <br>
<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="gmail_quote"><div><br>
&nbsp;</div><div><br>
no need to remove and re-add... i think it&#39;ll be ok if you simply make the change to the item, and then optimise.</div></div></blockquote><div>&nbsp;</div><div>I am curious to know about efficiency of reoptimisation ..&nbsp; n log n, n^2, whatever .. <br>
<br>Eric<br><br><br>&nbsp;<br></div></div><br>