[C언어 자료구조] Binary Search Tree와 level order traversal 문제2 : 코드 구현


[C언어 자료구조] Binary Search Tree와 level order traversal 문제2 : 코드 구현

파일 in.txt에 주어진 명령을 이용하여 원소들을 차례대로 BST에 insert하거나 BST에서 원소를 search하는 프로그램을 구성하라. 삽입할 원소가 tree에 이미 있는 경우에는 "(해당원소) cannot be inserted"를 출력한 뒤 tree에 삽입하지 않도록 처리한다. 원소를 삽입할 때마다 tree를 level order traversal한 결과를 출력하고, search명령이 있는 경우 search에 성공하면 "(해당원소) is in T", 실패하면 (해당원소) in not in T를 화면에 출력하라. < 실행 결과 예제1 > in.txt A 5 A 2 S 1 S 5 A 3 A 4 A 3 S 3 < 화면 출력 > A 5 : 5 A 2 : 5 2 S 1 : 1 is not in T S 5 : 5 is in T A 3 : 5 2 3 A 4 : 5 2 3 4 A 3 : 3 cannot be inserted S 3 : 3 is in T < 실행 결과 예제2 > in.txt...


#BinarySearchTree #C언어 #Levelordertraversal #Queue #Tree #자료구조

원문링크 : [C언어 자료구조] Binary Search Tree와 level order traversal 문제2 : 코드 구현