mirror of
https://github.com/krahets/hello-algo.git
synced 2026-08-24 17:17:14 +00: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