U E D R , A S I H C RSS

자료구족발보쌈/1117 (rev. 1.2)

자료구족발보쌈/1117

INTRO


1. 참여자 명단


함장 장용운 11학번 출석
선원 천준현 15학번 결석
박인서 출석
이원준 출석
남헌 탈주닌자

2. 수업

2.1. 진행

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

2.2. 내용

번외편
  • Set
  • Map

3. 코드

3.1. 예제1


4. 숙제

1. 고통받기




5. 숙제 제출

5.1. 천준현


5.2. 박인서

  • bucket sort

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define LEN 5

typedef struct data{
	char * student;
	struct data * next;
}stu;

void push(stu * data,char * val)
{
	stu * temp=(stu *)malloc(sizeof(stu));
	temp->student=val,temp->next=NULL;
	while(data->next!=NULL) data=data->next;
	data->next=temp;
}

void print(stu * data)
{
	if(data->next==NULL) return;
	printf("%s : ",data->student);
	while(data->next->next!=NULL)
	{
		data=data->next;
		printf("%s, ",data->student);
	}
	printf("%s\n",data->next->student);
}

int main()
{
	stu data[8];
	char * key=(char *)malloc(sizeof(char)*3);
	char * value[LEN];
	int i;
	data[0].student="A+",data[1].student="A0";
	data[2].student="B+",data[3].student="B0";
	data[4].student="C+",data[5].student="C0";
	data[6].student="D+",data[7].student="D0";
	for(i=0;i<8;i++) data[i].next=NULL;
	for(i=0;i<LEN;i++) value[i]=(char *)malloc(sizeof(char)*100);
	for(i=0;i<LEN;i++)
	{
		printf("insert %d key\n",i+1);
		scanf("%s",key);
		printf("insert %d value\n",i+1);
		scanf("%s",value[i]);
		if(!strcmp(key,"A+")) push(&data[0],value[i]);
		if(!strcmp(key,"A0")) push(&data[1],value[i]);
		if(!strcmp(key,"B+")) push(&data[2],value[i]);
		if(!strcmp(key,"B0")) push(&data[3],value[i]);
		if(!strcmp(key,"C+")) push(&data[4],value[i]);
		if(!strcmp(key,"C0")) push(&data[5],value[i]);
		if(!strcmp(key,"D+")) push(&data[6],value[i]);
		if(!strcmp(key,"D0")) push(&data[7],value[i]);
	}
	for(i=0;i<8;i++) print(&data[i]);
	return 0;
}

5.3. 이원준


Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:30:39
Processing time 0.0253 sec