반응형

2016/06/12 14

SJF(Shortest Job First) 스케쥴링 알고리즘, 탐욕(Greedy) 알고리즘 [C++ 소스]

SJF(Shortest Job First) 스케쥴링 알고리즘탐욕(Greedy) 알고리즘 [C++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다. //SJF(Shortest Job First) 스케쥴링#include #include #include #include using namespace std; class Job{ string name; int length; int start_time; int wait_time; int end_time;public: Job(string name,int length) { this->name = name; this->length = length; start_time = 0; end_time = 0; wait_time = 0; } bool Do() { lengt..

거스름 돈 알고리즘 탐욕(Greedy) 알고리즘 [C++ 소스]

거스름 돈 알고리즘탐욕(Greedy) 알고리즘 [C++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다. //거스름 돈 (탐욕 알고리즘)//Program.cpp#include using namespace std; enum MType{ One=1, Five=5, Ten=10, Fifty=50,Hun=100,FHun=500, Thous=1000,FTh=5000, TenTh=10000,FTenTh=50000}; class Calculator{ static const MType mtypes[10]; MType money; int value; int remain; int marr[10];public: Calculator(MType money, int value) { this->money = money; ..

그래프에서 최단 거리 찾기 알고리즘, 다익스트라 알고리즘 [C++ 소스]

그래프에서 최단 거리 찾기 알고리즘다익스트라 알고리즘 [C++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//Edge.h#pragma once#include using namespace std;class Edge{ string vt1; string vt2; int weight;public: Edge(string vt1,string vt2,int height); bool Exist(string vt)const; bool Exist(string vt1, string vt2)const; string Other(string vt)const; void View()const; int GetWeight()const; };//Edge.cpp #include "Edge.h" #include using na..

너비 우선 탐색(Breath First Search) 그래프를 정점과 간선 집합으로 표현 [C++ 소스]

너비 우선 탐색(Breath First Search) 그래프를 정점과 간선 집합으로 표현 [C++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//Edge.h#pragma onceclass Edge{ int vt1; int vt2;public: Edge(int vt1,int vt2); bool Exist(int vt)const; bool Exist(int vt1, int vt2)const; int Other(int vt)const; void View()const; };//Edge.cpp #include "Edge.h" #include using namespace std; Edge::Edge(int vt1,int vt2) { this->vt1 = vt1; this->vt2 = vt2; } bo..

너비 우선 탐색(Breath First Search) 그래프를 인접 행렬 표현 [C++ 소스]

너비 우선 탐색(Breath First Search) 그래프를 인접 행렬 표현 [C++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//Graph.h#pragma once#include #include using namespace std;typedef vector Neighbors;class Graph{ const int vn;//정점의 개수 int **matrix;//인접 행렬 public: Graph(int vn); ~Graph(void); void AddEdge(int start, int goal);//간선 추가 void ViewNeighbors()const; void ViewNeighbor(int vt)const; Neighbors FindNeighbors(int vt); };//Gr..

깊이 우선 탐색(Depth First Algorithm) 그래프를 정점과 간선 집합으로 표현 [C++ 소스]

깊이 우선 탐색(Depth First Algorithm) 그래프를 정점과 간선 집합으로 표현 [C++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//Edge.h#pragma onceclass Edge{ int vt1; int vt2;public: Edge(int vt1,int vt2); bool Exist(int vt)const; bool Exist(int vt1, int vt2)const; int Other(int vt)const; void View()const; };//Edge.cpp #include "Edge.h" #include using namespace std; Edge::Edge(int vt1,int vt2) { this->vt1 = vt1; this->vt2 = vt2; } ..

깊이 우선 탐색(Depth First Algorithm) 그래프를 인접 행렬로 표현 [C++ 소스]

깊이 우선 탐색(Depth First Algorithm) 그래프를 인접 행렬로 표현 [C++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//Graph.h#pragma once#include #include using namespace std;typedef vector Neighbors;class Graph{ const int vn;//정점의 개수 int **matrix;//인접 행렬 public: Graph(int vn); ~Graph(void); void AddEdge(int start, int goal);//간선 추가 void ViewNeighbors()const; void ViewNeighbor(int vt)const; Neighbors FindNeighbors(int vt); };/..

방향성 있는 그래프를 인접 행렬로 표현 [C++ 소스]

방향성 있는 그래프를 인접 행렬로 표현 [C++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//Graph.h#pragma once#include #include using namespace std;typedef vector Neighbors;class Graph{ const int vn;//정점의 개수 int **matrix;//인접 행렬 public: Graph(int vn); ~Graph(void); void AddEdge(int start, int goal);//간선 추가 void ViewNeighbors()const; void ViewNeighbor(int vt)const; Neighbors FindNeighbors(int vt);};//Graph.cpp#include "Graph...

방향성 없는 그래프를 인접 행렬로 표현 [C++ 소스]

방향성 없는 그래프를 인접 행렬로 표현 [C++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//Graph.h#pragma once#include #include using namespace std;typedef vector Neighbors;class Graph{ const int vn;//정점의 개수 int **matrix;//인접 행렬 public: Graph(int vn); ~Graph(void); void AddEdge(int start, int goal);//간선 추가 void ViewNeighbors()const; void ViewNeighbor(int vt)const; Neighbors FindNeighbors(int vt); };//Graph.cpp #include "Grap..

동적 프로그래밍(Dynamic Programming) 순열 문제 [C++ 소스]

동적 프로그래밍(Dynamic Programming) 순열 문제 [C++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//Heuristic.h#pragma once#include #include using namespace std;typedef vector Bucket;typedef Bucket::iterator BIter;typedef Bucket::const_iterator CBIter; class Heuristic;typedef vector Heues;typedef Heues::iterator HIter;typedef Heues::const_iterator CHIter; class Heuristic{ Bucket original; Bucket out;public: Heuristic(Bu..

반응형