Sunday, August 2, 2009

Can u please help me in implementing a hashed oct tree?
oct tree in C language using hashing?

can u please help me in implementing a hashed oct tree?


i need to writea code in C to implement a oct tree that will hash data structure.if u hav any idea......plz tell me.......


if u need any other details.....u plz ask....


i will give each and every detail....

Can u please help me in implementing a hashed oct tree?


oct tree in C language using hashing?
Hi,


you can try this code... For traversal








Traverse(Key_t key, int (*MAC)(hcell *),


void (*postf)(hcell *))


{


hcell *pp;


unsigned int child;


if ((pp=Find(key)) %26amp;%26amp; MAC(pp)) return;


key = KeyLshift(key, NDIM);


for (child = 0; child %26lt; (1%26lt;%26lt;NDIM); child++)


Traverse(KeyOrInt(key, child), MAC, postf);


postf(pp);


}


This code applies an arbitraryMACto determine whether


to continue traversing the children of a cell. If the children


are traversed, than another function, postf, is called upon


completion of the descendants. By appropriate choice of


the MAC and postf one can execute pre-order or post-against the MAC. If it passes the MAC, the corresponding


cell data is placed on the interaction list. If a daughter


fails the MAC, it is placed on the output walk list. After


the entire input list is processed the output walk list is


copied to the walk list and the process iterates. The process


terminates when there are no nodes remaining on the walk


list. This method has an advantage over a recursive traversal


in that there is an opportunity to do some vectorization of


the intermediate traversal steps, since there are generally a


fair number of nodes which are being tested at a time. It


also results in a final interaction list which can be passed


to a fully vectorized force calculation routine. The details


are too intricate to allow us to present real C code, so we


present the algorithm in pseudocode instead:


ListTraverse((*MAC)(hcell *))


{


copy root to walk_list;


while (!Empty(walk_list)) {


for (each item on walk_list) {


for (each daughter of item) {


if (MAC(daughter))


copy daughter to interact_list;


else


copy daughter to output_walk_list;


}


}


walk_list = output_walk_list;


}


}


When the traversal is complete, the interact_list


contains a vector of items that must undergo interactions


(according to the particular MAC). The interactions themselves


may be computed separately, so that code may be


vectorized and optimized independently of the tree traversal


method.





Thanks


Kiran





P.S. If you need anything u can contact me on mail or IM


No comments:

Post a Comment