1. 순환 큐.1. 순환 큐 클래스.#include "20160324.h" void CreateQueue(CircularQueue** _Queue, int _Capacity) { #ifdef CPP (*_Queue) = new CircularQueue; (*_Queue)->tNode = new Node[_Capacity + 1]; #else (*_Queue) = (CircularQueue*)malloc(sizeof(CircularQueue)); (*_Queue)->tNode = (Node*)malloc(sizeof(Node) * (_Capacity + 1); #endif (*_Queue)->nCapacity = _Capacity; (*_Queue)->nFront = 0; (*_Queue)->nRear =..
1. 링크드 리스트 스택.1. 링크드 리스트 스택 클래스.#include "20160322.h" #ifdef CPP using namespace std; #endif void CreateStack(Stack** _Stack) { #ifdef CPP (*_Stack) = new Stack; #else (*_Stack) = (Stack*)malloc(sizeof(Stack)); #endif (*_Stack)->List = NULL; (*_Stack)->Top = NULL; } void DestroyStack(Stack* _Stack) { while(!IsEmpty(_Stack)) { Node* Current = Pop(_Stack); DestroyNode(Current); } } Node* CreateNod..
1. 링크드 리스트. 1. 링크드 리스트 클래스. #include "20160321.h" Node* CreateNode(ElementType NewData) { #ifdefCPP Node* NewNode = new Node; #else Node* NewNode = (Node*)malloc(sizeof(Node)); #endif memset(NewNode, 0, sizeof(Node)); NewNode->Data = NewData; NewNode->NextNode = NULL; return NewNode; } void DestroyNode(Node* Node) { #ifdefCPP delete Node; #else free(Node); #endif Node = NULL;//댕글린 포인터 해제. } void..