added partion algorithm