mirror of
https://github.com/krahets/hello-algo.git
synced 2025-07-06 22:34:18 +08:00
Update README for zh-hant version (#1228)
* Bug fixes * Fix the term in heap figures * Unify the font of the chapter covers for the zh, en, and zh-Hant version * Sync the zh-hant vertion with the main branch * Update README for testing * Update README for testing * Update README for testing * Update README for zh, en, zh-hant version * Fix the issue links * Update README * Update README * edition -> version
This commit is contained in:
@ -106,7 +106,7 @@ def log_recur(n)
|
||||
log_recur(n / 2) + 1
|
||||
end
|
||||
|
||||
### 线性对数阶
|
||||
### 线性对数阶 ###
|
||||
def linear_log_recur(n)
|
||||
return 1 unless n > 1
|
||||
|
||||
|
@ -5,7 +5,7 @@ Author: Xuan Khoa Tu Nguyen (ngxktuzkai2000@gmail.com)
|
||||
=end
|
||||
|
||||
### 生成一个数组,元素为: 1, 2, ..., n ,顺序被打乱 ###
|
||||
def random_number(n)
|
||||
def random_numbers(n)
|
||||
# 生成数组 nums =: 1, 2, 3, ..., n
|
||||
nums = Array.new(n) { |i| i + 1 }
|
||||
# 随机打乱数组元素
|
||||
@ -27,7 +27,7 @@ end
|
||||
|
||||
for i in 0...10
|
||||
n = 100
|
||||
nums = random_number(n)
|
||||
nums = random_numbers(n)
|
||||
index = find_one(nums)
|
||||
puts "\n数组 [ 1, 2, ..., n ] 被打乱后 = #{nums}"
|
||||
puts "数字 1 的索引为 #{index}"
|
||||
|
Reference in New Issue
Block a user