mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-09 14:06:06 +00:00
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:
@@ -9,7 +9,7 @@
|
||||
/* Hash search (array) */
|
||||
int hashingSearchArray(unordered_map<int, int> map, int target) {
|
||||
// Hash table's key: target element, value: index
|
||||
// If the hash table does not contain this key, return -1
|
||||
// If this key does not exist in the hash table, return -1
|
||||
if (map.find(target) == map.end())
|
||||
return -1;
|
||||
return map[target];
|
||||
@@ -18,7 +18,7 @@ int hashingSearchArray(unordered_map<int, int> map, int target) {
|
||||
/* Hash search (linked list) */
|
||||
ListNode *hashingSearchLinkedList(unordered_map<int, ListNode *> map, int target) {
|
||||
// Hash table key: target node value, value: node object
|
||||
// If the key is not in the hash table, return nullptr
|
||||
// Return nullptr if key does not exist in hash table
|
||||
if (map.find(target) == map.end())
|
||||
return nullptr;
|
||||
return map[target];
|
||||
@@ -36,7 +36,7 @@ int main() {
|
||||
map[nums[i]] = i; // key: element, value: index
|
||||
}
|
||||
int index = hashingSearchArray(map, target);
|
||||
cout << "The index of target element 3 is " << index << endl;
|
||||
cout << "Index of target element 3 = " << index << endl;
|
||||
|
||||
/* Hash search (linked list) */
|
||||
ListNode *head = vecToLinkedList(nums);
|
||||
@@ -47,7 +47,7 @@ int main() {
|
||||
head = head->next;
|
||||
}
|
||||
ListNode *node = hashingSearchLinkedList(map1, target);
|
||||
cout << "The corresponding node object for target node value 3 is " << node << endl;
|
||||
cout << "Node object corresponding to target node value 3 is " << node << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user