'분류 전체보기'에 해당되는 글 255건

  1. 2017.07.13 동백역 하얀집 화과자 1
  2. 2017.07.13 리북집 족발 맛있다
  3. 2017.02.14 오빠언제오나
  4. 2017.02.14 Bills, 잠실
  5. 2017.02.10 일어나서 회사가자
  6. 2017.02.10 새 카메라 2
  7. 2015.05.12 상추랑 깻잎 1 6
  8. 2014.03.26 단순연결리스트 5
  9. 2014.03.12 북경
  10. 2014.02.05 북경01




동백역 하얀집



맛있고, 예쁘고 다 좋은데

문을 잘 안 연다.

인스타그램 공지를 확인하고 한번쯤 가볼만한 곳

















'near' 카테고리의 다른 글

연남동 풍경  (0) 2017.11.23
수원 화성 나들이  (4) 2017.10.24
리북집 족발 맛있다  (0) 2017.07.13
Bills, 잠실  (0) 2017.02.14
새 카메라  (2) 2017.02.10
Posted by :



엠이 알려준 리북집

진짜 맛있다.













'near' 카테고리의 다른 글

수원 화성 나들이  (4) 2017.10.24
동백역 하얀집 화과자  (1) 2017.07.13
Bills, 잠실  (0) 2017.02.14
새 카메라  (2) 2017.02.10
상추랑 깻잎 1  (6) 2015.05.12
Posted by :



오빠 언제 오나















'nari' 카테고리의 다른 글

일어나서 회사가자  (0) 2017.02.10
산책  (0) 2013.06.02
눈썹생긴 나리  (0) 2013.06.02
석병이 자는데 꺠우는 나리  (2) 2013.05.17
해맑은 나리  (0) 2013.04.07
Posted by :















'near' 카테고리의 다른 글

동백역 하얀집 화과자  (1) 2017.07.13
리북집 족발 맛있다  (0) 2017.07.13
새 카메라  (2) 2017.02.10
상추랑 깻잎 1  (6) 2015.05.12
서울 루덴스  (1) 2013.12.15
Posted by :














'nari' 카테고리의 다른 글

오빠언제오나  (0) 2017.02.14
산책  (0) 2013.06.02
눈썹생긴 나리  (0) 2013.06.02
석병이 자는데 꺠우는 나리  (2) 2013.05.17
해맑은 나리  (0) 2013.04.07
Posted by :


























'near' 카테고리의 다른 글

리북집 족발 맛있다  (0) 2017.07.13
Bills, 잠실  (0) 2017.02.14
상추랑 깻잎 1  (6) 2015.05.12
서울 루덴스  (1) 2013.12.15
밤 한강 코스모스  (2) 2013.10.03
Posted by :

 

 

삼겹살 친구 데려왔다

 

 

 

 

 

'near' 카테고리의 다른 글

Bills, 잠실  (0) 2017.02.14
새 카메라  (2) 2017.02.10
서울 루덴스  (1) 2013.12.15
밤 한강 코스모스  (2) 2013.10.03
빨리가자큐큐큐  (0) 2013.07.13
Posted by :

 

 

 

 

 

 

단순연결리스트 [Singly linked list] 

 

 

#include 

struct Node
{
	int          data;
	struct Node* next;
};

void PrintNodes(struct Node* root)
{
	Node* temp = root;
	printf("--------------NODES--------------\n");
	int i = -1;
	while( temp != NULL){
		if(i == -1) printf("root");
		else
		{
			printf("pos");
			printf("%d", i);
		}
		printf(": ");
		printf("%d", (int)temp);
		printf(" / data: ");
		printf("%d", temp->data);
		printf(" / next: ");
		printf("%d", (int)temp->next);
		printf("\n");
		temp = temp->next;
		i++;
	}printf("---------------------------------\n");
}

Node* CreateNode(Node* newnew)
{
	newnew = new Node;
	newnew->data = 0;
	newnew->next = NULL;
	return newnew;
}

int GetNodeCount(Node* root)
{
	int count = 0;
	Node* temp = root;
	while( temp->next != NULL )
	{
		count++;
		temp = temp->next;
	}
	return count;
}

Node* GetNode(Node* root, int pos)
{
	int count = 0;
	Node* get = root;
	while( get->next != NULL)
	{
		get = get->next;
		if( count == pos ) break;
		count++; 
	}
	return get;
}

int Insert(struct Node* root, int position)
{
	Node* NewNode = NULL;
	NewNode = CreateNode(NewNode);
	Node* prev = NULL;
	prev = GetNode(root, position-1);

	if(GetNodeCount(root) < position) return 0; //없는거 못 만든다.
	if( position == GetNodeCount(root) )
	{
		prev->next = NewNode;
		return 1;
	}
	else
	{
		Node* after = NULL;
		after = GetNode(root, position);
		if( position==0 ) root->next = NewNode;
		else    prev->next = NewNode;
		NewNode->next = after;
		return 1;
	}
	return 0;
}

int Delete(struct Node* root, int position)
{
	int a = GetNodeCount(root);
	if(GetNodeCount(root) <= position) return 0; //없는거 못 지운다.
	else
	{
		Node* deletedNode = NULL;
		deletedNode = GetNode(root, position);
		Node* afterDeletedNode = NULL;
		afterDeletedNode = GetNode(root, position+1);
		if(position == 0) 
			root->next = afterDeletedNode; //첫번째꺼 지우면 root에 나머지 연결
		else
		{
			Node* prevDeletedNode = NULL;
			prevDeletedNode = GetNode(root, position-1);
			int a = GetNodeCount(root);
			if(position == GetNodeCount(root)-1) 
				prevDeletedNode->next = NULL;
			else 
				prevDeletedNode->next = afterDeletedNode;
		}
		delete deletedNode;
		return 1;
	}
}

int SetData(struct Node* root, int position, int data)
{
	if( root->next != NULL && GetNodeCount(root) > position )
	{
		GetNode(root,position)->data = data;
		return 1;
	}
	else return 0;
}

int GetData(struct Node* root, int position, int* data)
{
	if( root->next != NULL && GetNodeCount(root) > position )
	{
		*data = GetNode(root,position)->data;
		return 1;
	}
	else return 0;
}

void main()
{
	Node* root = NULL;
	root  = CreateNode(root);
	int data = 0;

	/* position==0 created */	printf("%d ", Insert(root,0));  printf(" inserted \n");
	/* position==0 set to 7 */	printf("%d ", SetData(root,0,7)); printf(" set \n");
	/* position==1 created */	printf("%d ", Insert(root,1));  printf(" inserted \n");
	/* position==0 added */		printf("%d ", Insert(root,0));  printf(" inserted \n");
	/* --> 원래 있던 노드 밀어냄 */

	/* position==3 created */	printf("%d ", Insert(root,3));  printf(" inserted \n");
	/* position==3 deleted */	printf("%d ", Delete(root,3));  printf(" inserted \n");
	/* position==5 created */	printf("%d ", Delete(root,5));  printf(" inserted \n");
	/* --> 앞에 빈 노드 있으므로 생성 못함 */

	/* position==3 created */	printf("%d ", Insert(root,3));  printf(" inserted \n");
	/* position==2 set to 5 */	printf("%d ", SetData(root,2,5)); printf(" set \n");
	/* position==3 set to 6 */	printf("%d ", SetData(root,3,6)); printf(" set \n");
	/* position==7 get  */		GetData(root, 7, &data);  printf("%d ", data);   printf(" got \n");
	/* --> 빈 노드이므로 데이터 얻지 못함 */

	/* position==2 get  */		GetData(root, 2, &data);  printf("%d ", data);   printf(" got \n");

	PrintNodes(root);
	printf("total nodes: "); printf("%d ", GetNodeCount(root)); printf("\n\n");
	delete root;
}
Posted by :

 

 

 

Beijing

2014/02/03 - 2014/02/25

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

'far' 카테고리의 다른 글

2014 제주도 경미식당 맛나식당 전복밥  (0) 2017.07.13
2014 제주도 신라호텔  (2) 2017.07.13
북경01  (0) 2014.02.05
[2013스페인] 론다 거리  (0) 2013.08.29
[2013스페인] 론다 선경이  (0) 2013.08.29
Posted by :

 

 

 

선배가 그려준 지도 한장 들고
북경, 베이징에 도착했다.



10호선 하늘색라인

 

 

첫 날은 전 출장자들과 함께

춘절이라 그나마 한가하지만 요새 인기라는 녹차 식당에 갔다.

 

 

싼 가격의 메뉴가 엄청 많아서 골라먹는 재미로 유명한가부다.

 

요리 이름이 한글로도 적혀있다.

쇠고기의 유혹 닭의 유혹, 유혹 시리즈도 있고

오번역 된 것들도 있고 재밌다 흐흐

 

 

(돼지고기 바비큐)

짭짤하지만 제일 한국 음식과 비슷하다.

 

 

(메뉴 이름 기억안남)

간장궁중떡볶이 맛 떡과 버섯

 

 

(아이스겨자)

샐러리(?)같은 얼음에 꽂힌 채소를 간장+겨자많이 소스에 찍어먹는데,

훔 의외로 괜찮다.

 

 

(닭 ??)

 

 

(매콤한 새우)

 

 

(두부연어샐러드)

두부연어샐러드를 왜 간장+겨자많이 소스에..으앗

중독된다며 계속 드시는 분도 계셨다.

 

 

(닭 바비큐)

짭짤하고 맥주 안주 맛 ㅎㅎ

 

 

(파초나무 버섯요리)

버섯은 맛있었고 파초나무인지 나물은 움..시키지 말자!

 

 

(누룽지탕)

시키지 말자!

 

 

(개구리)

비주얼에 압박당함.

 

 

(우유빙수)

장난감과자 맛

 

 



히히 노트북을 이고다녀 온몸이 피곤했고
영어와 카드는 공항 호텔 말고는 통하지 않았고
춘절기간이라 한산하지만 어디선가 여기저기서 계속 폭죽을 터뜨리는 나라가 신기했다.







'far' 카테고리의 다른 글

2014 제주도 신라호텔  (2) 2017.07.13
북경  (0) 2014.03.12
[2013스페인] 론다 거리  (0) 2013.08.29
[2013스페인] 론다 선경이  (0) 2013.08.29
[2013스페인] 마드리드  (3) 2013.08.18
Posted by :