Bidirectional Bubble Sort is now applied to (*) to sort the elements
that are adjacent as shown in Figure 4.
2.2. Bidirectional Bubble Sort “Bidirectional Bubble Sort also known as Cocktail Sort or Shaker Sort is a variation of Bubble Sort that is both a stable sorting algorithm and a comparison sort. The algorithm differs from Bubble Sort in that it sorts in both directions each pass through the list. The average number of comparisons is slightly reduced by this approach” [12]. “This sorting algorithm is just slightly more difficult than Bubble Sort to implement. It solves the problem with so-called turtles in Bubble Sort” [13]. FIGURE 2 below illustrates Bidirectional Bubble Sort for sorting the list