Sort 정렬
#include #include using namespace std; class Student{public: string name; int score; Student(string name, int score){ this->name = name; this->score = score; } bool operator score b;} int main(void){ Student students[] = { Student("DYKIM", 90), Student("SEKIM", 96), Student("SYKIM", 93), Student("JEKIM", 99), Student("MJKIM", 80), }; sor..
더보기
Dijkstra 다익스트라 알고리즘
#include #define N 6int number = 6;int INF = 100000000; // init graphint graph[N][N] = { {0, 2, 5, 1, INF, INF}, {2, 0, 3, 2, INF, INF}, {5, 3, 0, 3, 1, 5}, {1, 2, 3, 0, 1, INF}, {INF, INF, 1, 1, 0, 2}, {INF, INF, 5, INF, 2, 0},}; bool visited[N];int minD[N]; // return shortest path indexint getSmallIndex(){ int min = INF; int index = 0; for(int i = 0; i < number; i++){ if(minD[i] < min && !visi..
더보기