Data structure & Algorithm
  • Initial page
  • 1212
  • 121231
  • 2.algorithm
    • 2.1.backtracking
      • 2.1.1.連續序列的排列組合(可能會重複)
      • 2.1.3.一串數列中任取n個數字, 總共有幾種組合
      • 2.1.2.一串數列中取n個數字, 共有幾種組合
    • 2.5.Quick sort
    • 2.6.2.6.廣度優先搜尋 (Breadth-first Search)
    • 2.2.Binary Search
    • 2.1.Backtracking
    • 2.4.河內塔 (Tower of Hanoi)
    • 2.7.動態規劃
    • 2.8.深度優先搜尋 (Depth-first Search)
    • 2.7.二分搜尋法
    • 2.3.分治法 (Divide and Conquer)
  • 2.Count and Say
  • 1.Leetcode Algorithm Practice
  • 2-count-and-say
    • c-solution
    • javascript-solution
  • Algorithm
  • 123
Powered by GitBook
On this page

Was this helpful?

  1. 2.algorithm

2.3.分治法 (Divide and Conquer)

Previous2.7.二分搜尋法Next2.Count and Say

Last updated 5 years ago

Was this helpful?

  • Introduction

    • 將問題先切分成小問題後再解決, 再將結果合併求出原始問題的答案

  • 作法

    • 1.分解:將原問題分解為若干個規模較小,相對獨立,與原問題形式相同的子問題。

    • 2.解決:若子問題規模較小且易於解決時,則直接解。否則,遞歸地解決各子問題。

    • 3.合併:將各子問題的解合併為原問題的解。

  • 程式碼

2.4.河內塔 (Tower of Hanoi)