Finished NLogN and N(Linear) solutions