fix bug (core dumped when array includes few equal elements)
reorganization of project