Skip to content

Create 206. Reverse Linked List.md#20

Open
Apo-Matchbox wants to merge 1 commit intomainfrom
206.-Reverse-Linked-List
Open

Create 206. Reverse Linked List.md#20
Apo-Matchbox wants to merge 1 commit intomainfrom
206.-Reverse-Linked-List

Conversation

@Apo-Matchbox
Copy link
Owner

```

- ポインタの反転版 (走査しながら リンクの向きを1本ずつ逆向きに付け替えるだけ)という考え方もある。
-> stackを使わないという点では、この問題意図とは異なるが、一つの例として。

Choose a reason for hiding this comment

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

私がもし、Stackで入力をひっくり返す、というテクニックを問いたいなら、Linked Listではなくもう少しシンプルな問題設計をするように思います。Linked Listを扱う問題なら、繋ぎかえが正しく行えるかが難しく、見たいところような気がするので、こちらが想定解かもしれませんね。

Copy link
Owner Author

Choose a reason for hiding this comment

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

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

ご意見頂きありがとうございます。
確かにLinked Listを扱う問題であれば、正しく繋ぎかえができるかがみたいと考えるのがみたい所ですかね。
改めて問題意図を意識して、書いてみようと思います。


```
while (node)と記載していたが、pointerを条件式で使用すると、boolへ変換される。e.g. nullptr->false、非nullptr->true
可読性という点で、while (node) だとbool? int? と一瞬考えると感じ、上記の書き方のまま採用した。参考:https://google.github.io/styleguide/cppguide.html#Boolean_Expressions

Choose a reason for hiding this comment

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

以前私が調べた限りでは、どちらの派閥の方々もいらっしゃるようで、どちらでも良さげに見えました。柔軟に、所属しているチームのスタイルガイドに従うと良いかな、と思っています。

参考: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#es87-dont-add-redundant--or--to-conditions

Copy link
Owner Author

Choose a reason for hiding this comment

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

@huyfififi
こちら随分とご返信遅くなってしまい申し訳ありません。

貴重なご意見ありがとうございます。
未経験+9ヶ月ほどしか書いてないので、実際の現場での感覚など非常にありがたいです。
都度reference確認しながら、所属するスタイルガイドに都度合わせられるように学習進めてみます。

Copy link

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

LGTM です

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.

3 participants