#include #include #define SZ 7 int queue[SZ]; int front = 0; int rear = 0; int isEmpty() { return (rear == front); } int isFull() { return ((rear + 1) % SZ == front); } int deque() { if (isEmpty() == 1) { return -999; } int temp = queue[front]; front = (front + 1) % SZ; return temp; } void enque(int n) { int if100 = 0; if (isFull() == 1) { return; } if (n == 100) { while (isEmpty() == 0) { if100..
#include #include #define SZ 100 int stack[SZ]; int top = -1; int isEmpty() { return (top == -1); } int isFull() { return (top == (SZ - 1)); } int pop() { if (isEmpty() == 1) { return -999; } int temp; temp = stack[top--]; return temp; } void push(int n) { int if100 = 0; int popped = 0; if (isFull() == 1) { return; } if (n == 100) { while (isEmpty() == 0) { popped = pop(); if100 = if100 + popped..
#include #include //node 구조체정의 struct node { int data; struct node *next; struct node *prev; }; struct node* head = 0; struct statNode{ int data; int freq; struct statNode *prev; struct statNode *next; }; struct statNode *shead = 0; //returns the pointer to the node which has bigger data than _data //returns null if _data is the biggest struct statNode *whoIsBigger(int _data) { struct statNode *..
#include #include struct node { int data; struct node *next; struct node *prev; }; struct node* head = 0; void addToDLL(int n) { struct node* cur; cur = (struct node*)malloc(sizeof(struct node)); cur->data = n; cur->next = 0; cur->prev = 0; if (head == 0) { head = cur; return; } { //끝을 찾는다 struct node* temp = head; while (temp->next != 0) { temp = temp->next; } temp->next = cur; cur->prev = temp..
// Singly Linked List #include #include int in1, in2; //node 구조체정의 struct node { int data; struct node *next; }; struct node* head = 0; struct node* head2 = 0; //sLL에 추가하는함수 void addToSLL(int data) { struct node *cur; cur = (struct node*)malloc(sizeof(struct node)); cur->data = data; cur->next = 0; //1.SLL이 empty if (head == 0) { head = cur; return; } //2 else //2.1끝을찾자 //2.2끝에 붙이자 { struct node..