1
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.

priority_queue

Last updated at Posted at 2022-02-21

優先度付きキューというデータ構造を管理できる型(降順、昇順など)

a.push(x) (xを追加)

a.pop() (xを削除)

a.top() (xを習得)

a.size()

a.empty()

計算量は O(logN)

//最も小さい値を取り出す(定義)
priority_queue<int, vector<int>, greater<int>> a;

//最も大きい値を取り出す(定義)
priority_queue<int, vector<int>, less<int>> b;
1
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
1
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?