일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
- String 클래스
- StringBuffer 클래스
- C# 소스 코드
- java
- 디딤돌 Java 언어 Part1
- 소프트웨어 접근성
- C언어
- 파일 입출력
- 동적 메모리 할당
- C언어 소스
- 소스 구현
- 설계 패턴
- 무료 Java
- C언어 표준 라이브러리 함수 사용법 가이드
- C#
- 알고리즘
- C언어 소스 코드
- Escort GoF의 디자인 패턴
- math.h
- 소스 코드
- C++
- C언어 표준 라이브러리 함수 가이드
- JAVA 언어
- 디딤돌 C++
- XML.NET
- 클래스 다이어그램
- 디딤돌 C언어
- gof의 디자인 패턴
- 소스 파일
- 소프트웨어 설계
- Today
- 11
- Total
- 125,084
목록C++/디딤돌 자료구조와 알고리즘 with C++ (38)
프로그램 소스
크루스칼(Kruscal) 알고리즘, 최소신장 트리탐욕(Greedy) 알고리즘 [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; string GetVt1()const; string GetVt..
프림(Prim) 알고리즘, 최소신장 트리탐욕(Greedy) 알고리즘 [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; string GetVt1()const; string GetVt2()co..
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++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다. //거스름 돈 (탐욕 알고리즘)//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++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//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++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//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++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//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++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//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++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//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++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//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++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//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++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//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..
병합 정렬 (Merge Sort) 알고리즘 [C++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//common.h#pragma once#include #include #include #include #include #include using namespace std; class Member{ string name; int num;public: Member(string name,int num) { this->name = name; this->num = num; } string GetName()const { return name; } int GetNum()const { return num; } void View()const { cout
수식 계산기, 파서 트리컴파일러 이론 접목(어휘분석, 구문분석,파싱) [C++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//Token.h#pragma once#include using namespace std;#include class Token{ int priority;public: virtual void View()const=0; bool MoreThanPriority(Token *token); protected: void SetPriority(int priority);}; #include using namespace std;typedef vector Tokens;typedef Tokens::iterator TIter; typedef Tokens::const_iterator CTIte..
힙 정렬 (Heap Sort) 알고리즘 [C++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다. //common.h (정렬 알고리즘에 공통으로 사용할 내용) #pragma once #include #include #include #include #include #include using namespace std; class Member { string name; int num; public: Member(string name,int num) { this->name = name; this->num = num; } string GetName()const { return name; } int GetNum()const { return num; } void View()const { cout
장르별 도서 관리 프로그램, STL의 vector,list,map 사용 [C++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//ehglobal.h#pragma once#pragma warning(disable:4996)#include using std::string;#include using std::cout;using std::cin;using std::ostream;using std::endl;#include #include enum keydata{ NO_DEFINED,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,ESC}; //공통적으로 사용할 정적 메서드를 캡슐화한 클래스class ehglobal{public: static void clrscr();//화면을 지우는 메서드 ..
회원 관리 프로그램, STL map 사용 [C++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//ehglobal.h#pragma once#pragma warning(disable:4996)#include using std::string;#include using std::cout;using std::cin;using std::ostream;using std::endl;#include #include enum keydata{ NO_DEFINED,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,ESC}; //공통적으로 사용할 정적 메서드를 캡슐화한 클래스class ehglobal{public: static void clrscr();//화면을 지우는 메서드 static void timef..
회원 관리 프로그램, STL map 사용 [C++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//ehglobal.h#pragma once#pragma warning(disable:4996)#include using std::string;#include using std::cout;using std::cin;using std::ostream;using std::endl;#include #include enum keydata{ NO_DEFINED,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,ESC}; //공통적으로 사용할 정적 메서드를 캡슐화한 클래스class ehglobal{public: static void clrscr();//화면을 지우는 메서드 static void timef..
도서 관리 프로그림, 이진 탐색 트리 [C++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//ehglobal.h#pragma once#pragma warning(disable:4996)#include using std::string;#include using std::cout;using std::cin;using std::ostream;using std::endl;#include #include enum keydata{ NO_DEFINED,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,ESC}; //공통적으로 사용할 정적 메서드를 캡슐화한 클래스class ehglobal{public: static void clrscr();//화면을 지우는 메서드 static void timeflo..
순차 탐색과 이진 탐색 알고리즘 성능 비교 [C++소스]"본문 내용"은 언제나 휴일 본 사이트에 있습니다.#include #include #include #include using namespace std; int *sequentailsearch(int *base, size_t n, int value){ for(size_t s = 0; s
퀵 정렬 (Quick Sort) 알고리즘 [C++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//common.h#pragma once#include #include #include #include #include #include using namespace std; class Member{ string name; int num;public: Member(string name,int num) { this->name = name; this->num = num; } string GetName()const { return name; } int GetNum()const { return num; } void View()const { cout
하노이 타워 [C++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//하노이 타워#include #include using namespace std;void Hanoi(string src, string use, string dest, int n){ if(n
STL list 흉내내서 만들기 [C++] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//list.h#pragma oncenamespace ehlib{ template class list { struct node { Data data; node *prev; node *next; node(Data data=0) { this->data = data; prev = next = 0; } }; node *head; node *tail; int count; public: class iterator { node *now; public: iterator(node *now=0) { this->now = now; } Data operator *()const { return now->data; } operator n..
STL vector 흉내내서 만들기 [C++] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//vector.h#pragma oncenamespace ehlib{ template class vector { Data *base; size_t bcapacity; size_t bsize; public: class iterator { Data *pos; public: iterator(Data *pos=0) { this->pos = pos; } Data operator *()const { return *pos; } int operator-(const iterator &iter)const { return pos - iter.pos; } iterator &operator++() { pos++; return (*t..
라운드 로빈 스케쥴러 시뮬레이션 [C++] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//EHProcess.h#pragma once#include #include using namespace std; class EHProcess{ string pname; //프로그램 이름 const int tjob; //전체 작업량 const int cjob; //cpu 점유 시 수행가능 최대 작업량 int ntjob; //현재 남은 작업량 int ncjob; //현재 cpu 점유 시 수행가능 최대 작업량public: EHProcess(string pname,int tjob,int cjob); void IdleToReady();//Idle 상태에서 Ready 상태로 전이 int Running();//CPU를 점유..
원형 큐 [C++소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//원형 큐#include using namespace std; class Queue{ int *buffer; const int size; int front; int rear; public: Queue(int size):size(size) { buffer = new int[size]; front = rear = 0; } ~Queue() { delete[] buffer; } bool Put(int data) { if(IsFull()) { return false; } buffer[rear] = data; rear = Next(rear); return true; } int Get() { if(IsEmpty()) { return 0; } ..
스택 [C++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//스택#include using namespace std; class Stack{ int *buffer; const int size; int top;public: Stack(int size):size(size) { top = -1; buffer = new int[size]; } ~Stack() { delete[] buffer; } bool Push(int data) { if(IsFull()) { return false; } top++; buffer[top] = data; return true; } int Pop() { if(IsEmpty()) { return 0; } int re = buffer[top]; top--; return ..
STL list 사용, 정렬 상태를 유지 (특정 키 순으로 보관) [C++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//ehglobal.h#pragma once#pragma warning(disable:4996)#include using std::string;#include using std::cout;using std::cin;using std::ostream;using std::endl;#include #include enum keydata{ NO_DEFINED,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,ESC}; //공통적으로 사용할 정적 메서드를 캡슐화한 클래스class ehglobal{public: static void clrscr();//화면을 지우는 메서드 sta..
STL list 사용, 순차 보관 [C++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//ehglobal.h#pragma once#pragma warning(disable:4996)#include using std::string;#include using std::cout;using std::cin;using std::ostream;using std::endl;#include #include enum keydata{ NO_DEFINED,F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,ESC}; //공통적으로 사용할 정적 메서드를 캡슐화한 클래스class ehglobal{public: static void clrscr();//화면을 지우는 메서드 static void timeflow(..
이중 연결리스트 [C++ 소스] "본문 내용"은 언제나 휴일 본 사이트에 있습니다.//이중 연결리스트#include using namespace std; class DoubledLinkedList{ struct Node { int data; Node *prev; Node *next; Node(int data=0) { this->data = data; prev = next = 0; } }; Node *head; Node *tail;public: class Iterator//연결 리스트에 보관한 데이터를 탐색하기 위한 반복자 { Node *node;//현재 노드의 위치 정보 public: friend class DoubledLinkedList;//연결리스트에서는 모든 멤버에 접근 권한 부여 Iterator(..