Skip to content

Create 703. Kth Largest Element in a Stream.md#21

Open
Apo-Matchbox wants to merge 1 commit intomainfrom
703.-Kth-Largest-Element-in-a-Stream
Open

Create 703. Kth Largest Element in a Stream.md#21
Apo-Matchbox wants to merge 1 commit intomainfrom
703.-Kth-Largest-Element-in-a-Stream

Conversation

@Apo-Matchbox
Copy link
Copy Markdown
Owner


private:
int k_;
std::priority_queue<int, std::vector<int>, std::greater<int>> min_heap_;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

データ構造を表す名前を変数名に入れても、あまり情報は増えないように思います。中にどのような値が含まれているかを変数名に付けたほうが読みやすくなると思います。 k_largest_values_ はいかがでしょうか?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nodchip
ご返信随分と遅くなり大変申し訳ございません、

ご指摘頂いた通りですね。中身が何かをしっかりと意識した変数名をつけるようにします。

Copy link
Copy Markdown

@ryosuketc ryosuketc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

よいと思います。

* Streaming Process データが大量で、全部を保持できない。
- 目的:stream が次々とくる。オンライン。
- データサイズ:入力が無限に続く可能性有。全部保持したくない。
- * k は大きい?小さい?:ここで躓いた。どのくらいの高さになるかはlognから割り出せるが、それが大きい?小さい?の判断が良くわからない。
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

今回の問題は大学の入学試験という設定のようなので、どんなに大きくてもkは10万として、log_2(100000)≒17くらいなので小さいと考えてよさそうです。

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maeken4
こちらご返信随分と遅くなり大変申し訳ございません。

コメントありがとうございます。
推定(概算)から考えるんですね。未経験なので、あまりここら辺の感覚がわからずでして。。。
もう少し当たり前の所を気を配っていきたいと思います。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants