Skip to content

Instantly share code, notes, and snippets.

View hanjae-jea's full-sized avatar

Hanjae hanjae-jea

View GitHub Profile
@hanjae-jea
hanjae-jea / Red_Black_tree_visualization_test.h
Created June 15, 2013 00:26
์†Œ์Šค ์ฝ”๋“œ์— Test_Tree(Tree* , rb_insert ํ•จ์ˆ˜ ์ด๋ฆ„, rb_delete ํ•จ์ˆ˜ ์ด๋ฆ„๋งŒ ์ ์–ด์„œ ํ˜ธ์ถœํ•˜๋ฉด ์“ฐ์‹ค ์ˆ˜ ์žˆ์Šต๋‹น.) ex) Test_Tree(tree, rb_insert, rb_delete); rb_insert(Tree *tree, Node *z), rb_delete(Tree *tree, Node *z) ์ด๋ ‡๊ฒŒ ๊ตฌํ˜„๋งŒ ๋˜์–ด์žˆ์Œ ๋ฉ๋‹ˆ๋‹ค... HW#14 Special ๊ณผ์ œ์ธ Red-Black Tree Visual Test Code์ž…๋‹ˆ๋‹ค. ๋ณธ HW#14.c ์ฝ”๋“œ์˜ ๊ฐ™์€ ํŒŒ์ผ์— ์ €์žฅํ•˜์‹  ํ›„์— #include "ํŒŒ์ผ์ด๋ฆ„.h"์„ ๋ณธ ์ฝ”๋“œ์— ์ถ”๊ฐ€ํ•ด์ฃผ๋ฉด ๋ฉ๋‹ˆ๋‹ค. ์ด ์ฝ”๋“œ๋ฅผ ์ง‘์–ด๋„ฃ์„๋•Œ ์ฃผ์˜ํ•˜์‹ค๊ฑด #inclโ€ฆ
#include <stdio.h>
#include <stdlib.h>
#include <Windows.h>
enum rb {red, black};
typedef struct node {
int key;
enum rb color;
struct node *left;
@hanjae-jea
hanjae-jea / struct.c
Created April 23, 2013 09:09
[NHN NEXT] ๊ฐ„๋‹จํ•œ ๊ตฌ์กฐ์ฒด์˜ ์˜ˆ์ œ์™€, ๊ตฌ์กฐ์ฒด์˜ ํฌ์ธํ„ฐ๋ฅผ ์ ‘๊ทผํ•˜๋Š” ๊ฐ„๋‹จํ•œ ์˜ˆ์‹œ๋ฅผ ์ž‘์„ฑํ•˜์˜€๋‹ค.
#include <stdio.h>
#include <string.h>
typedef struct student{
char name[15];
int number;
float total;
}student;
int main(void)
@hanjae-jea
hanjae-jea / sparce_matrix.cpp
Last active December 16, 2015 12:39
[NHN NEXT] Sparce Matrix ๊ตฌํ˜„ํ•˜๊ธฐ
#include <stdio.h>
#include <stdlib.h>
typedef struct SparceMatrix{
int rowId;
int colId;
int value;
}SparceMatrix;
int Arr[3][3] = {{0,3,0},
@hanjae-jea
hanjae-jea / Array.c
Created April 22, 2013 14:22
[NHN NEXT] ๋ฐฐ์—ด์ฐธ์กฐํ•˜๊ธฐ, mallocํ•จ์ˆ˜๋กœ ๋ฐ›์€ ๋ฉ”๋ชจ๋ฆฌ์—์„œ ์ด์ฐจ์›์œผ๋กœ ์ฐธ์กฐ๋ฐ›๋Š” ๋ฐฉ๋ฒ• ์†Œ๊ฐœ. ๋ฐฐ์—ด๊ณผ ํฌ์ธํ„ฐ ๋ถ€๋ถ„์—์„œ ์‚ฌ์šฉ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int Arr[3][5];
int *Brr = (int*)malloc( sizeof(int) * 15 );
int **Crr = (int**)malloc( sizeof(int*) * 3);
int rowIdx = 1, colIdx = 3, colSize = 5;
Crr[0] = Brr + 0 * colSize;
@hanjae-jea
hanjae-jea / linked_list.c
Last active December 16, 2015 11:39
[NHN NEXT]์—ฐ๊ฒฐ๋ฆฌ์ŠคํŠธ(linked_list)์˜ˆ์ œ ์ฝ”๋“œ ์ž…๋‹ˆ๋‹ค. next ๋งŒ ๊ฐ€์ง€๊ณ  ์žˆ๋Š” ์ผ์ค‘ ์—ฐ๊ฒฐ ๋ฆฌ์ŠคํŠธ๋ฅผ ๊ตฌํ˜„ํ•˜์˜€๊ณ , ๊ธฐ์ดˆ์ ์ธ ์‚ฝ์ž…, ์‚ญ์ œ ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ•˜์˜€์Šต๋‹ˆ๋‹ค.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct student{
char name[15];
struct student* next;
};
struct student *head, *tail;
void studentAddLast(char *name); // ์—ฐ๊ฒฐ๋ฆฌ์ŠคํŠธ ๋’ค ๋ถ€๋ถ„์— ํ•™์ƒ์„ ์‚ฝ์ž….
@hanjae-jea
hanjae-jea / Permutation_easy_version.c
Created March 24, 2013 12:17
[NHN NEXT] ์ž๋ฃŒ๊ตฌ์กฐ์™€ ์•Œ๊ณ ๋ฆฌ์ฆ˜ Permutation ์‰ฌ์šด ๋ฒ„์ ผ. & selection sort
#include <stdio.h>
#include <conio.h>
int n;
int check[10];
char list[10];
void perm(int);
void print(int);