Upgrade to Pro — share decks privately, control downloads, hide ads and more …

師大資工系ACM-ICPC讀書會:肆、鏈結串列與二元樹

Maplewing
December 06, 2013

 師大資工系ACM-ICPC讀書會:肆、鏈結串列與二元樹

師大資工系ACM-ICPC讀書會:肆、鏈結串列與二元樹

Maplewing

December 06, 2013
Tweet

More Decks by Maplewing

Other Decks in Programming

Transcript

  1. 刪除節點 22 12 32 node node.next node.next.next node *delnode =

    node.next; node.next = node.next.next; delete delnode;
  2. • 陣列 • 以0為root • 往編號n之左子樹:2*(n+1) - 1 • 往編號n之右子樹:2*(n+1)

    • 往父節點:floor((n-1)/2) • 鏈結串列 • struct node { int data; node *left, *right; }; 儲存方式