mirror of
https://github.com/krahets/hello-algo.git
synced 2024-12-26 02:56:29 +08:00
85ca4cce43
* feat: add ruby code chapter array & linked list - array.rb - linked_list.rb - list.rb - my_list.rb * feat: add ruby code blocks * chore: fix convention
15 lines
269 B
Ruby
15 lines
269 B
Ruby
=begin
|
|
File: print_util.rb
|
|
Created Time: 2024-03-18
|
|
Author: Xuan Khoa Tu Nguyen (ngxktuzkai2000@gmail.com)
|
|
=end
|
|
|
|
### 打印链表 ###
|
|
def print_linked_list(head)
|
|
list = []
|
|
while head
|
|
list << head.val
|
|
head = head.next
|
|
end
|
|
puts "#{list.join(" -> ")}"
|
|
end
|