더보기

4차

더보기

https://diymaker.tistory.com/118?category=729231

https://diymaker.tistory.com/118?category=729231
어..? 재귀함수란게 순서도로 그리려면.. 생략하는방법이없다면.. 무한히 그려야 되는거 아닐까..?
public void Print()
{
if (this.top == null)
{
Console.WriteLine("스택이 비어있습니다.");
}
else
{
PrintRecursive(this.top);
}
}
void PrintRecursive(Node node)
{
Console.WriteLine("data: {0}", node.Data);
if (node.Next != null)
{
PrintRecursive(node.Next);
}
}
2차 3차 사실 맞게 그린듯
'자료구조' 카테고리의 다른 글
Pop + peek (0) | 2021.12.28 |
---|---|
스택의 개수를 반환하는 메서드 +재귀적 (0) | 2021.12.28 |
스택 (stack) Push (0) | 2021.12.28 |
재귀함수 - Linked List에서 head부터 시작해서 마지막노드 반환 (0) | 2021.12.28 |
재귀함수 - 팩토리얼 (0) | 2021.12.28 |