This document contains code for implementing the shell sort algorithm in Java. It defines a shell class with a main method that creates an array of integers and calls the ordenacionShell method to sort it. The ordenacionShell method implements the shell sort algorithm by starting with a large interval size and iteratively reducing it, sorting sublists at each interval size using an insertion sort approach. It prints output at each step to show the progress of the algorithm.
This document contains code for implementing the shell sort algorithm in Java. It defines a shell class with a main method that creates an array of integers and calls the ordenacionShell method to sort it. The ordenacionShell method implements the shell sort algorithm by starting with a large interval size and iteratively reducing it, sorting sublists at each interval size using an insertion sort approach. It prints output at each step to show the progress of the algorithm.
This document contains code for implementing the shell sort algorithm in Java. It defines a shell class with a main method that creates an array of integers and calls the ordenacionShell method to sort it. The ordenacionShell method implements the shell sort algorithm by starting with a large interval size and iteratively reducing it, sorting sublists at each interval size using an insertion sort approach. It prints output at each step to show the progress of the algorithm.
public static void intercambiar(int []a, int i, int j){
int aux = a[i]; a[i] = a[j]; a[j]= aux ; // j+1 porque es lo se envia como parametro System.out.println("\t\t\t\t\t\t\t\t\t"+ i + "\t" + j + "\t" + aux + "\t" + a[i] + "\t" + a[j]); } }