mirror of
https://github.com/krahets/hello-algo.git
synced 2026-11-02 03:05:24 +08:00
* feat(ko): add the complete Korean online edition * Use UTF-8 for Python CI output on Windows * Remove print-book promotion from the Korean site * fix(ko): preserve emphasis before Korean particles
37 lines
715 B
C++
37 lines
715 B
C++
/**
|
|
* File: vertex.hpp
|
|
* Created Time: 2023-03-02
|
|
* Author: krahets ([email protected])
|
|
*/
|
|
|
|
#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;
|
|
}
|