Algorithm for insertion sort, bubble sort and linear search on integer arrays