Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#84 - Pancake Sorting #30

Open
NickWarm opened this issue Jan 14, 2017 · 0 comments
Open

#84 - Pancake Sorting #30

NickWarm opened this issue Jan 14, 2017 · 0 comments
Assignees

Comments

@NickWarm
Copy link
Collaborator

英文

There are n pancakes, all of different sizes, that are stacked on top of each other. You are allowed to slip a spatula under one of the pancakes and flip over the whole stack above the spatula. The objective is to arrange the pancakes according to their size with the biggest at the bottom. Figure 2.20 shows an instance of the puzzle for n = 7. Design an algorithm for solving this puzzle and determine the number of flips made by the algorithm in the worst case.

中文

存在n個大小各異的煎餅,他們彼此重疊在一起。允許你用一個平底鏟,將平底鏟塞到其中一個煎餅底下,並把鏟子上面所有的煎餅都翻轉過來。我們的目標是把煎餅按大小順序排列ㄝ使得最大的在最下面,最小的在最上面。圖2.20顯示在n = 7 時該問題的一個例子。請設計一個演算法解決這個謎題,並且得出該演算法在最糟糕的情況下需要的翻轉次數。

@NickWarm NickWarm changed the title # 84. PancakeSorting #84 - PancakeSorting Jan 15, 2017
@NickWarm NickWarm changed the title #84 - PancakeSorting #84 - Pancake Sorting Jan 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants