mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-13 15:56:05 +00:00
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
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* File: vertex.hpp
|
||||
* Created Time: 2023-03-02
|
||||
* Author: krahets (krahets@163.com)
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
/* Класс вершины */
|
||||
struct Vertex {
|
||||
int val;
|
||||
Vertex(int x) : val(x) {
|
||||
}
|
||||
};
|
||||
|
||||
/* На вход подается список значений vals, на выходе возвращается список вершин vets */
|
||||
vector<Vertex *> valsToVets(vector<int> vals) {
|
||||
vector<Vertex *> vets;
|
||||
for (int val : vals) {
|
||||
vets.push_back(new Vertex(val));
|
||||
}
|
||||
return vets;
|
||||
}
|
||||
|
||||
/* На вход подается список вершин vets, на выходе возвращается список значений vals */
|
||||
vector<int> vetsToVals(vector<Vertex *> vets) {
|
||||
vector<int> vals;
|
||||
for (Vertex *vet : vets) {
|
||||
vals.push_back(vet->val);
|
||||
}
|
||||
return vals;
|
||||
}
|
||||
Reference in New Issue
Block a user