Sorting an Array with Backtrack & Comparison with Bubble Sort

Jigyasha Arora, Suman Pant, Sandip Vijay, Suyash Bhardwaj, Vasim Ahmad · 2023

An algorithm to address the shortcoming of Bubble Sort.The short coming of bubble sort is that it is inefficient for large dataset and provides more execution time. The backtracking variable is used as a decision parameter. If the backtracking variable is greater than or equal to zero then shifting is used. The first element will be pointed by a backtrack variable, the second element by an array [i], and the third element by an array $[i+1]$, and two cases of shifting are applied. If the element to be shifted lies in the middle of the backtrack and array of $[i+1]$ and if the element to be shifted lies ahead of both array of $[i]$ and $[i+1]$. After completion of each pass, the two largest elements are placed at the end of an array in sorted order. ECLIPSE has been used for the code of sorting an array with Backtrack implemented in Java and MATLAB for analysis of the number of loops with respect to the number of elements for both algorithms. The result after implementing the algorithm proves that the backtracking method is much more efficient than bubble sort as the total number of iterations, execution time, space, and time complexity is much less as compared to bubble sort with random input sequences.

Read the paper · More papers on PaperTik