octree - Barnes Hut worst case memory scenario -
i want run barnes hut n-body simulation ( wikipedia article ). know how memory single node of octree occupy, can't figure out worst case memory usage scenario given number of particles. in short, i'm wondering how many nodes possibly exist in octree given number of particles. need know know how memory allocate octree. edit: oh, , i'm writing in c if wants give me code instead of , explanation. i have this, way worse worst case scenario. it's guaranteed @ least allocate enough memory. i'm hoping can give me little more memory efficient. int kbh_worstcase(int particles) { // returns number of nodes required store number of particles in worst case scenario int worst; unsigned int n; worst=1; n=1; while(n<particles) { n=n<<3; worst+=n; } return worst; } i'm not sure if such suitable criterion exists. octree takes account particles distribution change during simulation. effective depth of t...