Translate all code to English (#1836)

* Review the EN heading format.

* Fix pythontutor headings.

* Fix pythontutor headings.

* bug fixes

* Fix headings in **/summary.md

* Revisit the CN-to-EN translation for Python code using Claude-4.5

* Revisit the CN-to-EN translation for Java code using Claude-4.5

* Revisit the CN-to-EN translation for Cpp code using Claude-4.5.

* Fix the dictionary.

* Fix cpp code translation for the multipart strings.

* Translate Go code to English.

* Update workflows to test EN code.

* Add EN translation for C.

* Add EN translation for CSharp.

* Add EN translation for Swift.

* Trigger the CI check.

* Revert.

* Update en/hash_map.md

* Add the EN version of Dart code.

* Add the EN version of Kotlin code.

* Add missing code files.

* Add the EN version of JavaScript code.

* Add the EN version of TypeScript code.

* Fix the workflows.

* Add the EN version of Ruby code.

* Add the EN version of Rust code.

* Update the CI check for the English version  code.

* Update Python CI check.

* Fix cmakelists for en/C code.

* Fix Ruby comments
This commit is contained in:
Yudong Jin
2025-12-31 07:44:52 +08:00
committed by GitHub
parent 45e1295241
commit 2778a6f9c7
1284 changed files with 71557 additions and 3275 deletions
@@ -6,7 +6,7 @@ Author: Peng Chen (pengchzn@gmail.com)
class ArrayStack:
"""Stack class based on array"""
"""Stack based on array implementation"""
def __init__(self):
"""Constructor"""
@@ -17,7 +17,7 @@ class ArrayStack:
return len(self._stack)
def is_empty(self) -> bool:
"""Determine if the stack is empty"""
"""Check if the stack is empty"""
return self.size() == 0
def push(self, item: int):
@@ -31,13 +31,13 @@ class ArrayStack:
return self._stack.pop()
def peek(self) -> int:
"""Access stack top element"""
"""Access top of the stack element"""
if self.is_empty():
raise IndexError("Stack is empty")
return self._stack[-1]
def to_list(self) -> list[int]:
"""Return array for printing"""
"""Return list for printing"""
return self._stack
@@ -46,27 +46,27 @@ if __name__ == "__main__":
# Initialize stack
stack = ArrayStack()
# Element push
# Elements push onto stack
stack.push(1)
stack.push(3)
stack.push(2)
stack.push(5)
stack.push(4)
print("Stack stack =", stack.to_list())
print("stack =", stack.to_list())
# Access stack top element
# Access top of the stack element
peek: int = stack.peek()
print("Stack top element peek =", peek)
print("Top of the stack element peek =", peek)
# Element pop
# Element pop from stack
pop: int = stack.pop()
print("Popped element pop =", pop)
print("Stack after pop =", stack.to_list())
print("After pop stack =", stack.to_list())
# Get the length of the stack
size: int = stack.size()
print("Stack length size =", size)
print("Length of the stack size =", size)
# Determine if it's empty
# Check if it is empty
is_empty: bool = stack.is_empty()
print("Is the stack empty =", is_empty)