mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-01 11:29:51 +08:00
* docs: add Japanese documents (`ja/docs`) * docs: add Japanese documents (`ja/codes`) * docs: add Japanese documents * Remove pythontutor blocks in ja/ * Add an empty at the end of each markdown file. * Add the missing figures (use the English version temporarily). * Add index.md for Japanese version. * Add index.html for Japanese version. * Add missing index.assets * Fix backtracking_algorithm.md for Japanese version. * Add avatar_eltociear.jpg. Fix image links on the Japanese landing page. * Add the Japanese banner. --------- Co-authored-by: krahets <krahets@163.com>
36 lines
715 B
C++
36 lines
715 B
C++
/**
|
|
* 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;
|
|
} |