Could you please help me to write Java code for the given task?

Task:

A sorting alorithm works as follows:

procedure SSort (A:list of sortable items) is:

do

set a boolean variable to false

for each pair of adjacent elements A[i], A[i+1], starting from the

beginning of the array, do:

if A[i] and A[i+1] are in the wrong order then

swap A[i] and A[i+1]

set to true

end if

end for

if not swapped then

break do-while loop

end if

set to false

for each pair of adjacent elements A[I], A[I+1], starting from the

end of the array, do

if [i] and A[i+1] are in the wrong order then

swap A[i] and A[i+1]

set to true

end if

end for

while swapped //if no elements have...

Read More »

By: StackOverFlow - 5 days ago

Related Posts