-
버블 정렬 (Bubble Sort)언어/C, C++ 2021. 1. 25. 23:26
#pragma once class BubbleSort { private: int* m_data; int m_size; public: BubbleSort(int MAX = 100); ~BubbleSort(); void Sort(); void Swap(int& a, int& b, int& c); void InitData(int* data); int GetSize(); int* GetData(); }; BubbleSort.h #include "BubbleSort.h" BubbleSort::BubbleSort(int MAX) { m_data = new int[MAX]; m_size = MAX; } BubbleSort::~BubbleSort() { if (m_data) delete[] m_data; } void ..
-
선택 정렬 (Selection Sort)언어/C, C++ 2021. 1. 25. 18:24
#pragma once class SelectionSort { private: int* m_data; int m_size; public: SelectionSort(int MAX = 100); ~SelectionSort(); void Sort(); void Swap(int &a, int &b, int &c); void InitData(int* data); int GetSize(); int* GetData(); }; SelectionSort.h #include "SelectionSort.h" SelectionSort::SelectionSort(int MAX) { m_data = new int[MAX]; m_size = MAX; } SelectionSort::~SelectionSort() { if (m_dat..
-
원형 큐 (Circular Queue)언어/C, C++ 2021. 1. 19. 23:13
#pragma once const int MAX = 100; class CircularQueue { private: int* m_queue; int m_front; int m_tail; int m_max; int m_size; public: CircularQueue(int _max = MAX); ~CircularQueue(); void EnQueue(int _item); int DeQueue(); bool IsEmpty(); bool IsFull(); int GetFront(); int GetSize(); }; CircularQueue.h #include "CircularQueue.h" CircularQueue::CircularQueue(int _max) { m_front = 0; m_tail = 0; ..
-
연결 리스트 큐 (LinkedList Queue)언어/C, C++ 2021. 1. 19. 22:58
#pragma once struct Node { int data; Node* next; }; class LinkedListQueue { private: Node* m_front; Node* m_tail; int m_size; public: LinkedListQueue(); ~LinkedListQueue(); void EnQueue(int _item); int DeQueue(); int GetSize(); int GetFront(); }; LinkedListQueue.h #include "LinkedListQueue.h" LinkedListQueue::LinkedListQueue() { m_front = nullptr; m_tail = nullptr; m_size = 0; } LinkedListQueue:..
-
배열 큐 (Array Queue)언어/C, C++ 2021. 1. 19. 19:25
#pragma once const int MAX = 100; class ArrayQueue { private: int *m_queue; int m_front; int m_tail; int m_max; int m_size; public: ArrayQueue(int _max = MAX); ~ArrayQueue(); void EnQueue(int _item); int DeQueue(); bool IsEmpty(); bool IsFull(); int GetFront(); int GetSize(); }; ArrayQueue.h #include "ArrayQueue.h" ArrayQueue::ArrayQueue(int _max) { m_front = 0; m_tail = 0; m_max = _max; m_size ..