Stacks

  • 插入,刪除都在top端
  • LIFO (Last In First Out)

應用

  • 常用在return address的實做,像是nested function call。
  • Backtracking, Depth-First-Search。
  • Interrupt Handler, 紀錄狀態用。

Runtime Memory

|-- text section --|  -->  code
|-- data section --|  -->  global variables
|------- PC -------|  -->  next instruction address
|------ stack -----|  -->  activation record, return address, local variables
|------ heap ------|  -->  dynamic allocation memory space

Backtracking

N Queens Problem

八皇后問題是一個以西洋棋為背景的問題:如何能夠在8×8的西洋棋棋盤上放置八個皇后,使得任何一個皇后都無法直接吃掉其他的皇后?為了達到此目的,任兩個皇后都不能處於同一條橫行、縱行或斜線上。(Wiki)

References

results matching ""

    No results matching ""