Inflearn Community Q&A
RightRotate 코드 수정
Resolved
Written on
·
388
7
영상 마지막 부분에서 코드를 수정해주셨지만
수정이 안 된 코드도 있어서 다른 수강생분들께서 참고하시라고 올립니다.
Rookiss님이 올려놓으신 샘플 코드에는 수정본으로 올라와있습니다.
void BinarySearchTree::RightRotate(Node* y)
{
Node* x = y->left;
y->left = x->right;
if (x->right != _nil)
x->right->parent = y;
x->parent = y->parent;
if (x->parent == _nil)
_root = x;
else if (y == y->parent->left)
y->parent->left = x;
else
y->parent->right = x;
x->right = y;
y->parent = x;
}
기술면접
Quiz
41% of people got it wrong. Give it a try!
이진 탐색(Binary Search)을 배열에서 효율적으로 사용하기 위한 가장 중요한 전제 조건은 무엇인가요?
데이터가 무작위로 섞여 있어야 합니다.
데이터가 정렬되어 있어야 합니다.
데이터가 연결 리스트 구조로 되어 있어야 합니다.
모든 데이터가 고유한 값이어야 합니다.
Answer 2
3
0





