mirror of
https://github.com/krahets/hello-algo.git
synced 2026-11-08 18:53:08 +08:00
Retranslate the complete Japanese online edition from Chinese (#2008)
* Retranslate the complete Japanese online edition from Chinese * Fit Japanese homepage labels and localize heading permalinks * Point Japanese contribution instructions to the Japanese preview * Replace locale conditionals with multilingual UI tables
This commit is contained in:
@@ -6,14 +6,14 @@ Author: Peng Chen (pengchzn@gmail.com)
|
||||
|
||||
from collections import deque
|
||||
|
||||
"""Driver Code"""
|
||||
"""実行用コード"""
|
||||
if __name__ == "__main__":
|
||||
# キューを初期化する
|
||||
# Python では通常、両端キュー deque をキューとして使う
|
||||
# queue.Queue() は正統なキュークラスだが、あまり使いやすくない
|
||||
# Python では一般に、両端キューのクラス deque をキューとして使う
|
||||
# queue.Queue() は専用のキュークラスだが、やや使いづらい
|
||||
que: deque[int] = deque()
|
||||
|
||||
# 要素をエンキュー
|
||||
# 要素をエンキューする
|
||||
que.append(1)
|
||||
que.append(3)
|
||||
que.append(2)
|
||||
@@ -21,19 +21,19 @@ if __name__ == "__main__":
|
||||
que.append(4)
|
||||
print("キュー que =", que)
|
||||
|
||||
# キュー先頭の要素にアクセス
|
||||
# キューの先頭要素にアクセス
|
||||
front: int = que[0]
|
||||
print("先頭要素 front =", front)
|
||||
print("キューの先頭要素 front =", front)
|
||||
|
||||
# 要素をデキュー
|
||||
# 要素をデキューする
|
||||
pop: int = que.popleft()
|
||||
print("取り出した要素 pop =", pop)
|
||||
print("取り出し後 que =", que)
|
||||
print("デキューした要素 pop =", pop)
|
||||
print("デキュー後 que =", que)
|
||||
|
||||
# キューの長さを取得
|
||||
size: int = len(que)
|
||||
print("キューの長さ size =", size)
|
||||
|
||||
# キューが空かどうかを判定
|
||||
# キューが空か判定
|
||||
is_empty: bool = len(que) == 0
|
||||
print("キューが空かどうか =", is_empty)
|
||||
print("キューは空か =", is_empty)
|
||||
|
||||
Reference in New Issue
Block a user