basic octree techniques

I posted this question in the other forum and was told to post it here.
I have been given a project recently which involoves basic graphics and uses an octree method of subdivision. I have done plenty of research on octree and understand how it works but I can not program octree graphics myself! Every time I look for sample code all i find is very confusing code used for computer games which is still a little beyond me! Is there anyway i can look at code of simple cube broken down to smaller cubes in an octree style. I am doing the project in c++ and am struggling to come up with any coding which gives me this octree partitioning.
Can anyone help?..please

Octree is somewhat simple. Consider a cube that is bounded by X, -X, Y, -Y, Z and -Z. This cube is split by midpoints, along the axes of the points. The first point would be (0,0,0), then the next split in the first quadrant, or cube, would be done along (X/2, Y/2, Z/2). The theory is really simple, but using the octree can end up being complex. To understand octree, it is better to see it in action, rather than try to read the code for it. I suggest you find the octree examples in… They’re quite excellent.