본문 바로가기 메뉴 바로가기

더 나은 프로그래머가 되기 위하여.

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

더 나은 프로그래머가 되기 위하여.

검색하기 폼
  • Trash (25)
    • Programming (25)
      • 뇌를 자극하는 알고리즘 (25)
  • 방명록

Trash (25)
뇌를 자극하는 알고리즘 - 9. 그래프 : 위상정렬 (Topological Sort)

구현 소스 TopologicalSort.h #ifndef TOPOLOGICAL_SORT_H #define TOPOLOGICAL_SORT_H #include "AdjacencyListGraph.h" #include "SLL.h" void TopologicalSort(Vertex* V, Node** List); // 위상 정렬 함수 void TS_DFS(Vertex* V, Node** List); // 위상 정렬에 필요한 깊이 우선 탐색 함수의 수정판 // - 깊이 우선 탐색을 하되 #endif --------------------------------------------------------- AdjacencyListGraph.h #ifndef ADJACENCY_LIST_GRAPH #define ADJA..

Programming/뇌를 자극하는 알고리즘 2010. 11. 12. 10:23
뇌를 자극하는 알고리즘 - 9. 그래프 : 그래프 순회(Graph Traversal) - 깊이 우선 탐색(Depth First Search), 너비 우선 탐색(Breadth First Search)

구현 소스 GraphTraversal.h #ifndef GRAPH_TRAVERSAL_H #define GRAPH_TRAVERSAL_H #include "AdjacencyListGraph.h" #include "LinkedListQueue.h" void DFS(Vertex* V); // 깊이 우선 탐색(Depth First Search) => 재귀 호출(Stack)을 이용한 그래프 순회 방법 void BFS(Vertex* V, LinkedQueue* Queue); // 너비 우선 탐색(Breadth First Search) => 링크드리스트 큐를 활용한 그래프 순회 방법 #endif ---------------------------------------------------------------- Adja..

Programming/뇌를 자극하는 알고리즘 2010. 11. 8. 23:23
뇌를 자극하는 알고리즘 - 9. 그래프 : 인접리스트(Adjacency List)로 구현한 그래프

구현소스 AdjacencyListGraph.h #ifndef ADJACENCY_LIST_GRAPH #define ADJACENCY_LIST_GRAPH #include #include enum VisitMode { Visited=1, NotVisited=0 }; typedef int Element; typedef struct tagVertex { Element Data; enum VisitMode Visited; int Index; struct tagVertex* Next; // 다음 정점을 가리키는 링크 - 정점의 집합 struct tagEdge* AdjacencyList; // 정점이 가지는 간선들의 집합 // => 한 정점과 인접한 정점들을 찾을 수 있다. } Vertex; typedef struct..

Programming/뇌를 자극하는 알고리즘 2010. 11. 7. 23:02
뇌를 자극하는 알고리즘 - 8. 해시 테이블 : 개방 주소법(Open Addressing Hash Table)

구현 소스 OpenAddressing.h #ifndef OPEN_ADDRESSING_H #define OPEN_ADDRESSING_H #include #include #include typedef char* KeyType; typedef char* ValueType; enum ElementStatus { Empty = 0, Occupied = 1 }; typedef struct tagElementType { KeyType Key; ValueType Value; enum ElementStatus Status; }ElementType; typedef struct tagHashTable { int OccupiedCount; int TableSize; ElementType* Table; }HashTable; H..

Programming/뇌를 자극하는 알고리즘 2010. 11. 7. 10:56
뇌를 자극하는 알고리즘 - 8. 해시 테이블 : 체이닝(Chaining)

구현소스 ChainingHashTable.h #ifndef CHAINING_HASH_TABLE #define CHAINING_HASH_TABLE #include #include #include typedef char* KeyType; typedef char* ValueType; typedef struct tagNode { KeyType Key; ValueType Value; struct tagNode* Next; } Node; typedef Node* List; typedef struct tagHashTable { int TableSize; List* Table; // Linked List로 구현된 Node를 가리키는 더블 포인터 // HashTable 생성시 동적할당되어 포인터 배열로 쓰임. }Hash..

Programming/뇌를 자극하는 알고리즘 2010. 11. 7. 10:44
뇌를 자극하는 알고리즘 - 8. 해시 테이블 : 나눗셈법으로 구현된 간단한 해시 테이블

구현소스 SimpleHashTable.h #ifndef SIMPLE_HASH_TABLE #define SIMPLE_HASH_TABLE // 간단한 나눗셈법으로 구현한 Hash Table #include #include typedef int KeyType; typedef int ValueType; typedef struct tagNode { KeyType Key; ValueType Value; } Node; typedef struct tagHashTable { int TableSize; Node* Table; } HashTable; HashTable*SHT_CreateHashTable(int TableSize); voidSHT_Set(HashTable* HT, KeyType Key, ValueType Va..

Programming/뇌를 자극하는 알고리즘 2010. 11. 7. 10:33
뇌를 자극하는 알고리즘 - 7. 우선순위 큐와 힙: 우선순위 큐(Priority Queue)

구현 소스 PriorityQueue.h #ifndef PRIORITYQUEUE_H #define PRIORITYQUEUE_H #include #include #include typedef struct tagPQNode { int Priority; // 우선순위 void* Data; // 다양한 자료형을 우선순위큐 안에 담을 수 있도록 void* type으로 선언함. } PQNode; typedef struct tagPriorityQueue { PQNode* Nodes; // Node를 담는 배열 int Capacity; int UsedSize; } PriorityQueue; //////////// 함수 정의 /////////////// PriorityQueue*PQ_Create(int Init); voi..

Programming/뇌를 자극하는 알고리즘 2010. 10. 25. 16:01
뇌를 자극하는 알고리즘 - 7. 우선순위 큐와 힙: 힙(Heap)

구현소스 Heap.h #ifndef HEAP_H #define HEAP_H #include #include #include typedef int Element; typedef struct tagHeapNode { Element Data; } HeapNode; typedef struct tagHeap { HeapNode* Nodes; // 힙 배열 int Capacity; // 최대 용량 int UsedSize; // 사용 용량 } Heap; // Heap // 1. Heap은 완전 이진 트리 구조 // 2. Heap에서 가장 작은 데이터를 갖는 노드는 Root 노드이다. // 3. 완전 이진 트리를 유지하기 위해선 Node의 삽입 연산 수행시 최고 깊이, 최 우측에 새 노드를 추가 해야 한다. // - ..

Programming/뇌를 자극하는 알고리즘 2010. 10. 23. 01:00
뇌를 자극하는 알고리즘 - 6. 탐색 : 이진 탐색 트리(Binary Search Tree)

구현소스 BinarySearchTree.h #ifndef BINARY_SEARCH_TREE_H #define BINARY_SEARCH_TREE_H #include #include typedef int Element; typedef struct tagBSTNode { struct tagBSTNode *Left; struct tagBSTNode *Right; Element Data; } BSTNode; BSTNode*BST_CreateNode(Element NewData); voidBST_DestroyNode(BSTNode* Node); voidBST_DestroyTree(BSTNode* Tree); BSTNode*BST_SearchNode(BSTNode* Tree, Element Target); BSTNo..

Programming/뇌를 자극하는 알고리즘 2010. 10. 22. 00:03
뇌를 자극하는 알고리즘 - 6. 탐색 : 이진 탐색(Binary Search)

구현 소스 BinarySearch.h #ifndef BINARY_SEARCH_H #define BINARY_SEARCH_H #include #include #include typedef int Element; Element BinarySearch(Element Data[], int Size, Element Target); #endif ---------------------------------------------------------------------------------------- BinarySearch.cpp #include "BinarySearch.h" Element BinarySearch(Element Data[], int Size, Element Target) { int Left, Mid..

Programming/뇌를 자극하는 알고리즘 2010. 10. 21. 23:57
이전 1 2 3 다음
이전 다음
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
  • Pixel 색상값으로 구현한 간단한 충돌
  • WM_TIMER
  • IntersectRect
  • 윈도우즈 API 정복
  • Kinect Game Project
  • graph
  • SetTimer
  • Win32 API
  • PtInRect
  • Game project
  • Hash table
  • WinAPI
  • Ice Climber
  • Linked list
  • Farseer Physics
  • Tree
  • 뇌를 자극하는 알고리즘
  • 열혈강의C
  • Kinect Programming
  • Digits Folding
  • Stack
  • 2D Game Project
  • quick sort
  • 그림 맞추기 게임
  • Queue
  • Data Structures in C
  • MFC 예제
  • Tales of the Float Land
  • PackMan
  • WM_CONTEXTMENU
more
«   2025/07   »
일 월 화 수 목 금 토
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
글 보관함

Blog is powered by Tistory / Designed by Tistory

티스토리툴바