메뉴 바로가기 검색 및 카테고리 바로가기

한빛미디어

뇌를 자극하는 알고리즘

뇌를 자극하는 알고리즘 질의응답 게시판입니다.

271P 레드 블랙 트리 질문입니다

2012-02-14

|

by killkill14

2642

typedef struct tagRBTNode
{
    struct tagRBTNode* Parent;
    struct tagRBTNode* Left;
    struct tagRBTNode* Right;

    enum { RED, BLACK } Color;    

    ElementType Data;

} RBTNode

헤더 파일에서 선언되고

RBTNode* RBT_CreateNode( ElementType NewData )
{
    RBTNode* NewNode = (RBTNode*)malloc( sizeof(RBTNode) );
    NewNode->Parent  = NULL;
    NewNode->Left    = NULL;
    NewNode->Right   = NULL;
    NewNode->Data    = NewData;
    NewNode->Color = BLACK;

    return NewNode;
}

CPP정의하는데 BLACK 참고할 수 없다고 하네요 ;;

비주얼 스튜디오 2010으로 사용했습니다;;
댓글 입력