GithubHelp home page GithubHelp logo

pancake_sorting_ruby's Introduction

題目出處:Algorithmic puzzles的習題84題

筆記最初紀錄於note.mdGitHub wiki也有一份。

英文

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 時該問題的一個例子。請設計一個演算法解決這個謎題,並且得出該演算法在最糟糕的情況下需要的翻轉次數。

pancake_sorting_ruby's People

Contributors

nickwarm avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.