chap_01_List

kando·2023년 7월 7일
0

Vitamin Quiz 1-2

void SLL_DestroyALLNode(Node** list) { // Vitamin 1-2 >> 함수 선언 안하고 함수내에서 함수 호출하려면 sequential하게 작성
	Node* current = NULL;
	int count = SLL_GetNodeCount(*list);

	for (int i = 0; i < count; i++)
	{
		current = SLL_GetNodeAt(*list, 0);

		if (current != NULL)
		{
			SLL_RemoveNode(list, current);
			SLL_DestroyNode(current);
		}
	}
} 

Vitamin Quiz 1-3

	void DLL_PrintReverse(Node* head) { // Vitamin 1-3
		Node* tail = head;
		if (tail == NULL)
		{
			return;
		}
		while (tail->nextNode != NULL)
		{
			tail = tail->nextNode;
		}
		while (1)
		{
			if (tail == NULL)
			{
				break;
			}
			printf("%d\n", tail->data);
			tail = tail->prevNode;
		}
	}

연습문제
01.
삽입&삭제 : 메모리상의 연속된 Data를 당기고 미는 과정 필요(배열)
포인터(화살표)만 조정
02. ?
03. Node Member로 int count 추가
삭제. 삽입 연산에서 head의 count 변경

0개의 댓글

관련 채용 정보