Files
hello-algo/ru/codes/ruby/utils/vertex.rb
Yudong Jin 772183705e Add ru version (#1865)
* Add Russian docs site baseline

* Add Russian localized codebase

* Polish Russian code wording

* Update ru code translation.

* Update code translation and chapter covers.

* Fix pythontutor extraction.

* Add README and landing page.

* placeholder of profiles

* Use figures of English version

* Remove chapter paperbook
2026-03-28 04:24:07 +08:00

25 lines
680 B
Ruby
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
=begin
File: vertex.rb
Created Time: 2024-04-25
Author: Xuan Khoa Tu Nguyen (ngxktuzkai2000@gmail.com)
=end
# ## Класс вершины ###
class Vertex
attr_accessor :val
def initialize(val)
@val = val
end
end
# ## На вход подается список значений vals, на выходе возвращается список вершин vets ###
def vals_to_vets(vals)
Array.new(vals.length) { |i| Vertex.new(vals[i]) }
end
# ## На вход подается список вершин vets, на выходе возвращается список значений vals ###
def vets_to_vals(vets)
Array.new(vets.length) { |i| vets[i].val }
end