is largethe number of items per pass is smalland items move long distances this is very efficient as grows smallerthe number of items per pass increasesbut the items are already closer togetherwhich is more efficient for the insertion sort it' the combination of these trends that makes the shellsort so effective notice that later sorts (small values of hdon' undo the work of earlier sorts (large values of han array that has been -sorted remains -sorted after -sortfor example if this wasn' so the shellsort couldn' work java code for the shellsort the java code for the shellsort is scarcely more complicated than for the insertion sort starting with the insertion sortyou substitute for in appropriate places and add the formula to generate the interval sequence we've made shellsort( method in the arraysh classa version of the array classes from listing shows the complete shellsort java program listing the shellsort java program /shellsort java /demonstrates shell sort /to run this programc>java shellsortapp //class arraysh private double[thearray/ref to array thearray private int nelems/number of data items //public arraysh(int max/constructor thearray new double[max]/create the array nelems /no items yet //public void insert(double value/put element into array thearray[nelemsvalue/insert it nelems++/increment size //public void display(/displays array contents system out print(" =")for(int = <nelemsj++/for each elementsystem out print(thearray[ ")/display it system out println("")