Files
hello-algo/ru/codes/javascript/modules/Vertex.js
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

36 lines
890 B
JavaScript
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.
/**
* File: Vertex.js
* Created Time: 2023-02-15
* Author: Zhuo Qinyue (1403450829@qq.com)
*/
/* Класс вершины */
class Vertex {
val;
constructor(val) {
this.val = val;
}
/* На вход подается список значений vals, на выходе возвращается список вершин vets */
static valsToVets(vals) {
const vets = [];
for (let i = 0; i < vals.length; i++) {
vets[i] = new Vertex(vals[i]);
}
return vets;
}
/* На вход подается список вершин vets, на выходе возвращается список значений vals */
static vetsToVals(vets) {
const vals = [];
for (const vet of vets) {
vals.push(vet.val);
}
return vals;
}
}
module.exports = {
Vertex,
};