Re-translate the Japanese version (#1871)

* Retranslate Japanese docs with GPT-5.4

* Retranslate Japanese code with GPT-5.4
This commit is contained in:
Yudong Jin
2026-03-30 07:30:15 +08:00
committed by GitHub
parent fe6443235b
commit d7b2277d2b
1444 changed files with 83312 additions and 8363 deletions

View File

@@ -0,0 +1,40 @@
/**
* File: stack.cs
* Created Time: 2022-12-23
* Author: haptear (haptear@hotmail.com)
*/
namespace hello_algo.chapter_stack_and_queue;
public class stack {
[Test]
public void Test() {
/* スタックを初期化 */
Stack<int> stack = new();
/* 要素をプッシュ */
stack.Push(1);
stack.Push(3);
stack.Push(2);
stack.Push(5);
stack.Push(4);
// 注意stack.ToArray() で得られるのは逆順のシーケンスであり、インデックス 0 がスタックトップです
Console.WriteLine("スタック stack = " + string.Join(",", stack));
/* スタックトップの要素にアクセス */
int peek = stack.Peek();
Console.WriteLine("スタックトップ要素 peek = " + peek);
/* 要素をポップ */
int pop = stack.Pop();
Console.WriteLine("ポップした要素 pop = " + pop + "、ポップ後の stack = " + string.Join(",", stack));
/* スタックの長さを取得 */
int size = stack.Count;
Console.WriteLine("スタックの長さ size = " + size);
/* 空かどうかを判定 */
bool isEmpty = stack.Count == 0;
Console.WriteLine("スタックが空かどうか = " + isEmpty);
}
}