In: Computer Science
The following submission rules apply: • For those questions requiring programs, the solutions must be implemented using JavaScript or Java. o Appropriate self-documenting comments in the source code are mandatory, consistent with good programming practices. o Solutions must be provided in plain text so that formatting is not lost. • All answers must be provided in this document. • Sources must be given accurate and complete citations sufficient for the instructor to find and confirm them.
How can I determine or explain how BingoSort is a stable sorting algorithm or not?
You need to undertand what Stable means :
Suppose you have duplicates in an array , Lets say you want to
sort 10 2 2' 3 4 6 . [Added a ' on top
of 2 to differentiate two twos]
We can see there are Two twos in an array:-
Now as we know if we sort them we will get 2 2 3 4 6 10 but
a ) 2 2'3 4 6 10 . OR b)
2' 2 3 4 6 10 . [Which one out of a or
b ]
If we get the Order of Input means the algorithm is stable
ottherwise not . Means If we get A) in our Output then its
stable.
Use this Logic for BingoSort , Check during the duplicates
element what is the order of duplicates elements Are thier order
changed or remains same . If the ordering is same then its stable
else No.
BingoSort
Takes the advantage when duplicate element are there is array when
we get small element. It counts all the duplicate small elements
and move it in One pass. It maintains the stabilty during movinf
the dupolicate element.