0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

スタック、キュー

Posted at

スタック

function ƒ(x) {
 p=p+1;
 A[p]=x;
 return None;
}
function g() {
 x=A[p];
 p=p-1;
 return x;
}

後入れ

function ƒ(x) {
 p=p+1;
 A[p]=x;
 return None;
}

気づき

  • pはポインタの役割をしていたのか
  • p+1は配列の末尾にプッシュする時のアドレス計算

先出し

function g() {
 x=A[p];
 p=p-1;
 return x;
}

気づき

  • p-1は配列の末尾の要素をポップする時のアドレス計算
  • return x;で取り出している

キュー

先入れ先出しのデータ構造になっている。

気づき

キューのアルゴリズムの問題にあたって頑張ろう。

ハッシュ

任意のデータから一意に求めた固定長のデータ

ヒープ

親の値は子の値以上という制約で構成された木構造

出典

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?