Skip to content

Commit 1b08a04

Browse files
committed
docs(105, 106): further updates to binary tree construction documentation and implementations
1 parent 4dc5c6a commit 1b08a04

6 files changed

Lines changed: 38 additions & 6 deletions

File tree

Algorithm/BinaryTree/claude sonnet 4.6 extended/105. Construct Binary Tree from Preorder and Inorder Traversal/README_React.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ <h3 className="mt-0 text-teal-800 text-lg font-bold outfit">
10201020
<span key={v}
10211021
className={[
10221022
"px-2 py-1 rounded-lg border",
1023-
activeStep >= 2 && PREORDER.slice(0, activeStep - 1).includes(v)
1023+
activeStep >= 2 && PREORDER.slice(0, activeStep === 6 ? 5 : Math.max(0, activeStep - 2)).includes(v)
10241024
? "bg-emerald-200 border-emerald-500 text-emerald-900"
10251025
: "bg-white border-slate-200 text-slate-600"
10261026
].join(" ")}
@@ -1079,3 +1079,9 @@ <h3 className="mt-0 text-teal-800 text-lg font-bold outfit">
10791079
</script>
10801080
</body>
10811081
</html>
1082+
g)";
1083+
});
1084+
});
1085+
</script>
1086+
</body>
1087+
</html>

Algorithm/BinaryTree/claude sonnet 4.6 extended/106. Construct Binary Tree from Inorder and Postorder Traversal/Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal_Python.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,14 +118,16 @@ class Solution:
118118
f"inorder({len(inorder)}) と postorder({len(postorder)}) の長さが一致しません"
119119
)
120120

121-
# 空入力はそのまま None を返す(エラーではなく正常なエッジケース)
121+
# 空入力はエラーとする
122122
if not inorder:
123-
return None
123+
raise ValueError("入力が空です")
124124

125125
# 要素の型チェック:any() は最初に True が見つかった時点で停止するC実装の関数
126126
# (all() の逆。「1つでも非intがあれば True」)
127127
if any(not isinstance(x, int) for x in inorder):
128128
raise TypeError("inorder の全要素は int である必要があります")
129+
if any(not isinstance(x, int) for x in postorder):
130+
raise TypeError("postorder の全要素は int である必要があります")
129131

130132
# ── 再帰深度の設定 ─────────────────────────────────────────────────
131133
# Python のデフォルト再帰上限は1000。

Algorithm/BinaryTree/claude sonnet 4.6 extended/106. Construct Binary Tree from Inorder and Postorder Traversal/README_React.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,15 @@ <h3 className="mt-0 text-teal-800 text-base font-bold mb-2">{currentStepData.tit
10651065
const root = ReactDOM.createRoot(document.getElementById("react-steps"));
10661066
root.render(React.createElement(StepsApp));
10671067

1068+
// Re-highlight code after React renders
1069+
requestAnimationFrame(() => {
1070+
if (window.Prism) Prism.highlightAll();
1071+
});
1072+
</script>
1073+
</body>
1074+
</html>
1075+
;
1076+
10681077
// Re-highlight code after React renders
10691078
requestAnimationFrame(() => {
10701079
if (window.Prism) Prism.highlightAllUnder(document.getElementById("react-steps"));

public/Algorithm/BinaryTree/claude sonnet 4.6 extended/105. Construct Binary Tree from Preorder and Inorder Traversal/README_React.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ <h3 className="mt-0 text-teal-800 text-lg font-bold outfit">
10201020
<span key={v}
10211021
className={[
10221022
"px-2 py-1 rounded-lg border",
1023-
activeStep >= 2 && PREORDER.slice(0, activeStep - 1).includes(v)
1023+
activeStep >= 2 && PREORDER.slice(0, activeStep === 6 ? 5 : Math.max(0, activeStep - 2)).includes(v)
10241024
? "bg-emerald-200 border-emerald-500 text-emerald-900"
10251025
: "bg-white border-slate-200 text-slate-600"
10261026
].join(" ")}
@@ -1079,3 +1079,9 @@ <h3 className="mt-0 text-teal-800 text-lg font-bold outfit">
10791079
</script>
10801080
</body>
10811081
</html>
1082+
g)";
1083+
});
1084+
});
1085+
</script>
1086+
</body>
1087+
</html>

public/Algorithm/BinaryTree/claude sonnet 4.6 extended/106. Construct Binary Tree from Inorder and Postorder Traversal/README_React.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,15 @@ <h3 className="mt-0 text-teal-800 text-base font-bold mb-2">{currentStepData.tit
10651065
const root = ReactDOM.createRoot(document.getElementById("react-steps"));
10661066
root.render(React.createElement(StepsApp));
10671067

1068+
// Re-highlight code after React renders
1069+
requestAnimationFrame(() => {
1070+
if (window.Prism) Prism.highlightAll();
1071+
});
1072+
</script>
1073+
</body>
1074+
</html>
1075+
;
1076+
10681077
// Re-highlight code after React renders
10691078
requestAnimationFrame(() => {
10701079
if (window.Prism) Prism.highlightAllUnder(document.getElementById("react-steps"));

public/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,8 @@ <h1 class="site-title">
505505
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/BinarySearch/leetcode/81.%20Search%20in%20Rotated%20Sorted%20Array%20II/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Search in Rotated Sorted Array II - Technical Analysis</span></span><span class="file-path">Algorithm/BinarySearch/leetcode/81. Search in Rotated Sorted Array II/Claude/README.html</span></a></li>
506506
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/Other/leetcode/73.%20Set%20Matrix%20Zeroes/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Set Matrix Zeroes Algorithm - Python Implementation</span></span><span class="file-path">Algorithm/Other/leetcode/73. Set Matrix Zeroes/Claude/README.html</span></a></li>
507507
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/Dutch%20National%20Flag/leetcode/75.%20Sort%20Colors/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Sort Colors Algorithm - Interactive Technical Guide</span></span><span class="file-path">Algorithm/Dutch National Flag/leetcode/75. Sort Colors/Claude/README.html</span></a></li>
508-
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/Other/leetcode/54.%20Spiral%20Matrix/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Spiral Matrix Algorithm Analysis</span></span><span class="file-path">Algorithm/Other/leetcode/54. Spiral Matrix/Claude/README.html</span></a></li>
509508
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/Other/leetcode/59.%20Spiral%20Matrix%20II/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Spiral Matrix Algorithm Analysis</span></span><span class="file-path">Algorithm/Other/leetcode/59. Spiral Matrix II/Claude/README.html</span></a></li>
509+
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/Other/leetcode/54.%20Spiral%20Matrix/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Spiral Matrix Algorithm Analysis</span></span><span class="file-path">Algorithm/Other/leetcode/54. Spiral Matrix/Claude/README.html</span></a></li>
510510
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/Other/leetcode/90.%20Subsets%20II/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Subsets II - 反復的拡張法による重複排除 | アルゴリズム解説</span></span><span class="file-path">Algorithm/Other/leetcode/90. Subsets II/Claude/README.html</span></a></li>
511511
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/TwoPointers/leetcode/80.%20Remove%20Duplicates%20from%20Sorted%20Array%20II/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Two-Pointer Algorithm: Remove Duplicates from Sorted Array II</span></span><span class="file-path">Algorithm/TwoPointers/leetcode/80. Remove Duplicates from Sorted Array II/Claude/README.html</span></a></li>
512512
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/BinarySearch/leetcode/34.%20Find%20First%20and%20Last%20Position%20of%20Element%20in%20Sorted%20Array/READEME-typescript.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">TypeScript Binary Search Performance Analysis</span></span><span class="file-path">Algorithm/BinarySearch/leetcode/34. Find First and Last Position of Element in Sorted Array/READEME-typescript.html</span></a></li>
@@ -685,8 +685,8 @@ <h1 class="site-title">
685685
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/BinarySearch/leetcode/81.%20Search%20in%20Rotated%20Sorted%20Array%20II/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Search in Rotated Sorted Array II - Technical Analysis</span></span><span class="file-path">Algorithm/BinarySearch/leetcode/81. Search in Rotated Sorted Array II/Claude/README.html</span></a></li>
686686
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/Other/leetcode/73.%20Set%20Matrix%20Zeroes/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Set Matrix Zeroes Algorithm - Python Implementation</span></span><span class="file-path">Algorithm/Other/leetcode/73. Set Matrix Zeroes/Claude/README.html</span></a></li>
687687
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/Dutch%20National%20Flag/leetcode/75.%20Sort%20Colors/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Sort Colors Algorithm - Interactive Technical Guide</span></span><span class="file-path">Algorithm/Dutch National Flag/leetcode/75. Sort Colors/Claude/README.html</span></a></li>
688-
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/Other/leetcode/54.%20Spiral%20Matrix/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Spiral Matrix Algorithm Analysis</span></span><span class="file-path">Algorithm/Other/leetcode/54. Spiral Matrix/Claude/README.html</span></a></li>
689688
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/Other/leetcode/59.%20Spiral%20Matrix%20II/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Spiral Matrix Algorithm Analysis</span></span><span class="file-path">Algorithm/Other/leetcode/59. Spiral Matrix II/Claude/README.html</span></a></li>
689+
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/Other/leetcode/54.%20Spiral%20Matrix/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Spiral Matrix Algorithm Analysis</span></span><span class="file-path">Algorithm/Other/leetcode/54. Spiral Matrix/Claude/README.html</span></a></li>
690690
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/Other/leetcode/90.%20Subsets%20II/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Subsets II - 反復的拡張法による重複排除 | アルゴリズム解説</span></span><span class="file-path">Algorithm/Other/leetcode/90. Subsets II/Claude/README.html</span></a></li>
691691
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/TwoPointers/leetcode/80.%20Remove%20Duplicates%20from%20Sorted%20Array%20II/Claude/README.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">Two-Pointer Algorithm: Remove Duplicates from Sorted Array II</span></span><span class="file-path">Algorithm/TwoPointers/leetcode/80. Remove Duplicates from Sorted Array II/Claude/README.html</span></a></li>
692692
<li class="file-item" data-category="algorithm"><a class="file-link" href="Algorithm/BinarySearch/leetcode/34.%20Find%20First%20and%20Last%20Position%20of%20Element%20in%20Sorted%20Array/READEME-typescript.html"><span class="card-header"><span class="card-icon">🧩</span><span class="card-title">TypeScript Binary Search Performance Analysis</span></span><span class="file-path">Algorithm/BinarySearch/leetcode/34. Find First and Last Position of Element in Sorted Array/READEME-typescript.html</span></a></li>

0 commit comments

Comments
 (0)