chap internal sorting shellsort the next sort we consider is called shellsortnamed after its inventord shell it is also sometimes called the diminishing increment sort unlike insertion and selection sortthere is no real life intuitive equivalent to shellsort unlike the exchange sortsshellsort makes comparisons and swaps between non-adjacent elements shellsort also exploits the best-case performance of insertion sort shellsort' strategy is to make the list "mostly sortedso that final insertion sort can finish the job when properly implementedshellsort will give substantially better performance than th( in the worst case shellsort uses process that forms the basis for many of the sorts presented in the following sectionsbreak the list into sublistssort themthen recombine the sublists shellsort breaks the array of elements into "virtualsublists each sublist is sorted using an insertion sort another group of sublists is then chosen and sortedand so on during each iterationshellsort breaks the list into disjoint sublists so that each element in sublist is fixed number of positions apart for examplelet us assume for convenience that nthe number of values to be sortedis power of two one possible implementation of shellsort will begin by breaking the list into / sublists of elements eachwhere the array index of the elements in each sublist differs by / if there are elements in the array indexed from to there would initially be sublists of elements each the first sublist would be the elements in positions and the second in positions and and so on each list of two elements is sorted using insertion sort the second pass of shellsort looks at fewerbigger lists for our example the second pass would have / lists of size with the elements in the list being / positions apart thusthe second pass would have as its first sublist the elements in positions and the second sublist would have elements in positions and and so on each sublist of four elements would also be sorted using an insertion sort the third pass would be made on two listsone consisting of the odd positions and the other consisting of the even positions the culminating pass in this example would be "normalinsertion sort of all elements figure illustrates the process for an array of values where the sizes of the increments (the distances between elements on the successive passesare and below is java implementation for shellsort