Implementation of Barnes-Hut algorithm in 2-D