SWAP TREE
- 최초 등록일
- 2008.05.22
- 최종 저작일
- 2008.04
- 9페이지/
MS 워드
- 가격 1,500원
![할인쿠폰받기](/images/v4/document/ico_det_coupon.gif)
소개글
TREE 구조와 관련된 두 가지 알고리즘 중 하나를 선택하여 프로그램을 작성해 보는 과제였다. 두 가지의 알고리즘 중 링크드 리스트를 활용한 프로그램 작성을 경험하고자 SWAP TREE 프로그램을 선택하였다.
목차
1. 프로그램소스(+주석)
2. 실행결과
3. FLOW CHART
본문내용
1. 프로그램 소스
#include <stdio.h>
#include <malloc.h>
// 노드 구조체
typedef struct Node *tree_pointer;
typedef struct Node{
char data;
tree_pointer left_child, right_child, parent;
}Node;
tree_pointer root, now;
static int l=1, x=1, chk=1; //변수 X는 자식노드 생성시 오른쪽 / 왼쪽 선택
// 노드 생성
void CreateNode(char data)
{
tree_pointer ptr;
ptr = (tree_pointer) malloc(sizeof(struct Node));
if( root == 1 )
{
ptr->data = data;
ptr->parent = NULL;
ptr->right_child = NULL;
root = ptr;
now = root;
중략..
참고 자료
없음