zoukankan      html  css  js  c++  java
  • Dancing Links

    http://www.cnblogs.com/grenet/p/3145800.html
    Best elaboration on dancing list I found. in Chinese.

    Traditional backtracing is a heuristic-like procedure. Say, there are N items to try with one by one, when N[i] is picked, all rest N[i + 1, N-1] items would be tested one by one, too. What's more, due to recursive calls, there are a lot intermediate caching necessary to contain intermediate states. Very blindly procedure correct?

    Traditional backtracing is like, you are trying to find a place on the ground, because you cannot see through blocks.. OK, so the computer god Donald Knuth invented a smarter tool - dancing links. This is like, find a place on a helicopter floating above the city. You are able to see all blocks, and do some bookkeeping with constant time!

    Dancing Links, enables you to do a simplified, lightweighted backtracing:

    - Say N[i] conflicts with N[j], N[k], etc.. j, k > i, so when N[i] is picked, N[j], N[k] are eliminated (O(1) list update ops) from candidate list automatically!

    - During above procedures, you don't need extra buffer to store intermediate states: modified dancing links it is! So you wanna recover when backtracing? Similar const time recover do that! (O(1) list update ops)

    Here is a more complex and interesting example:
    http://m.blog.csdn.net/blog/mu399/7627862 (Tetris, Sudoku, N-Queens)

  • 相关阅读:
    MongoDB ObjectId
    MongoDB固定集合
    MongoDB 正则表达式
    MongoDB Map Reduce
    MongoDB操作
    VIM跳到指定行
    linux之echo命令
    rpm and yum commands
    CentOS 7 下的软件安装建议
    apt系统中sources.list文件的解析
  • 原文地址:https://www.cnblogs.com/tonix/p/4314788.html
Copyright © 2011-2022 走看看