in memory sorting when new item must be pushed into sorted array implemented