Add Go codes to docs, including

the chapter of stack and queue, the chapter of tree.
This commit is contained in:
Yudong Jin
2022-12-03 20:25:24 +08:00
parent 1d9a076cdd
commit ebf9024136
41 changed files with 898 additions and 486 deletions

View File

@@ -7,7 +7,7 @@
/* 随机访问元素 */
function randomAccess(nums){
// 在区间 [0, nums.length) 中随机抽取一个数字
const random_index = Math.floor(Math.random() * nums.length)
const random_index = Math.floor(Math.random() * nums.length)
// 获取并返回随机元素
random_num = nums[random_index]
return random_num

View File

@@ -21,4 +21,4 @@ function insertionSort(nums) {
/* Driver Code */
var nums = [4, 1, 3, 1, 5, 2]
insertionSort(nums)
console.log("排序后数组 nums = ", nums)
console.log("排序后数组 nums =", nums)