Groups in Array

Consider an array of length N (1 2 4 5 10) and k=3. Below are the groups of Arrays(1 2 4) and (5 10)There is a difference between sub-array and groups in array. They are not at all same.Sub Array of k=3 are following.(1 2 4) , (2 4 5) and (4 5 10) In this blog, we are discussing about groups in array not sub-array. a=(1 2 4 5 10)len1=${#a[@]}j=0i=1##Set the value of K herek=3##Get the number of Groups of Array a(( NoOflps=(len1+k-1)/k ))echo $NoOflps##Run the innner while loop…