Barnes Hut algorithm applied to gravity N body problem