Abstract

In this paper, we propose an algorithm for sorting n pancakes. The previous studies were focused on finding upper bound or lower bound regarding a limited n-pancake. This study, however, suggests the algorithms for n-pancake with $$n\ge 5$$n?5. The only constraint is that $$n\ge 5$$n?5, which eliminates the very strong constraints [$$n\equiv 0$$n?0 (mod 16), $$n\equiv 0$$n?0 (mod 14), $$n\equiv 3$$n?3 (mod 4), etc.] that were used in previous studies. In addition, the sorting cost of the proposed algorithm is almost a half, from other existing studies, despite the fact that it reduces the degree from $$n-1$$n-1 to $$\frac{n}{2}+1$$n2+1. We define the term `restricted reversal', and based on that terminology, we also propose simple sorting and improved sorting algorithms for the pancake sorting. Further, we examine the worst case time complexity and average time to complete a sort using the suggested algorithms. We also propose sorting costs for the evaluation of similar sorting algorithms such as pancake, burnt pancake, and signed permutation algorithms, and compare the sorting costs and constraints that were found in existing studies. In addition, we propose a burnt pancake sorting algorithm that employs the proposed restricted reversals.

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.