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.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
46 views
Public Class Public Static Void Int: Package
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]); } }