이게 쉬운거...

# 1. 참여자 명단 ¶

 함장 장용운 11학번 출석 선원 천준현 15학번 출석 박인서 출석 이원준 출석 남헌 출석
전원 출석!!+회식!!

# 2. 수업 ¶

## 2.1. 진행 ¶

1. 장소 : 6층 학회실
2. 시간 : 15시 ~ 17시

## 2.2. 내용 ¶

수심 4000m. 트리2
• BST(이진 탐색 트리)

1. 고통받기

# 5. 숙제 제출 ¶

## 5.2. 박인서 ¶

```#include <stdio.h>
#include <stdlib.h>

struct node{
int val;
struct node * lnext;
struct node * rnext;
};

void insert(struct node * target, int newval)
{
struct node * newnode = (struct node *)malloc(sizeof(struct node));
int lr=0;
newnode->lnext=NULL,newnode->rnext=NULL,newnode->val=newval;
while(1)
{
if(target->val>=newval)
{
if(target->lnext==NULL)
{
lr=-1;
break;
}
target=target->lnext;
}
else
{
if(target->rnext==NULL)
{
lr=1;
break;
}
target=target->rnext;
}
}
if(lr==-1) target->lnext=newnode;
else target->rnext=newnode;
}

int del(struct node * target, int find)
{
struct node * tlnode;
struct node *trnode;
struct node * ta;
while(1)
{
if(target->val>find)
{
if(target->lnext==NULL) return 0;
target=target->lnext;
}
else if(target->val<find)
{
if(target->rnext==NULL) return 0;
target=target->rnext;
}
else if(target->val==find) break;
else return 0;
}
tlnode=target->lnext;
trnode=target->rnext;
ta=target;
if(target->rnext==NULL)
{
if(target->lnext==NULL)
{
free(ta);
return 1;
}
else target=tlnode;
}
else
{
target=trnode;
while(target->lnext!=NULL)
target=target->lnext;
tlnode=target;
}
ta->lnext=NULL,ta->rnext=NULL;
free(ta);
return 1;
}

int main()
{
struct node * head=(struct node *)malloc(sizeof(struct node));
int ind,t;
char ch[10],a;
printf("초기값 설정 ㄱㄱ : ");
scanf("%d",&ind);
while(1)
{
printf("\ninsert(i)나 delete(d)나 exit(e)를 입력하세요 : ");
scanf("%s",ch);
a=ch[0];
if(a=='I' || a=='i')
{
printf("머 집어넣을꺼임? : ");
scanf("%d",&ind);
}
else if(a=='D' || a=='d')
{
printf("머 뺄꺼임? : ");
scanf("%d",&ind);
else printf("값 없어\n");
}
else if(a=='E' || a=='e') break;
else printf("제대로 입력하라고\n");
}
return 0;
}
```

## 5.3. 이원준 ¶

```#include<stdio.h>

typedef struct _node{
struct _node *Rnode;
struct _node *Lnode;
int var;
} node;

typedef struct _PQ{
node *one;
} PQ;
node *temp = (node*)malloc(sizeof(node));

temp->Lnode = NULL;
temp->Rnode = NULL;
temp->var = input;

return;
}

while (1){
if (dir->var < input){
if (dir->Rnode == NULL){
dir->Rnode = temp;
break;
}
else{
dir = dir->Rnode;
}
}
else{
if (dir->Lnode == NULL){
dir->Lnode = temp;
break;
}
else{
dir = dir->Lnode;
}
}
}
}

node *temp1;
node *temp2;
printf("없어 없다고!빼에에엑\n");
return;
}
node *dir;
if (temp1 == NULL){
return;
}
else{
while (dir->Rnode != NULL){
dir = dir->Rnode;
}

dir->Rnode = temp2;
}
return;
}

while (1){
if (dir->var < input){
if (dir->Rnode == NULL){
printf("없어\n");
return;
}
else{
if (dir->Rnode->var == input){
printf("있엉: %d\n", input);
temp1 = dir->Rnode->Rnode;
temp2 = dir->Rnode->Lnode;
dir->Rnode = temp1;
if (temp1 == NULL){
dir->Rnode = temp2;
return;
}
while (dir->Rnode != NULL){
dir = dir->Rnode;
}
dir->Rnode = temp2;
break;
return;
}
dir = dir->Rnode;
}
}
else{
if (dir->Lnode == NULL){
printf("없어\n");
return;
}
else{
if (dir->Lnode->var == input){
printf("있엉: %d\n", input);
if (dir->Lnode->var == input){
temp1 = dir->Lnode->Rnode;
temp2 = dir->Lnode->Lnode;
dir->Lnode = temp1;
if (temp1 == NULL){
dir->Lnode = temp2;
return;
}
while (dir->Rnode != NULL){
dir = dir->Rnode;
}
dir->Rnode = temp2;
break;
return;
}
dir = dir->Rnode;

}
dir = dir->Lnode;
}
}
}
}

void main(){
int i;