-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.c
82 lines (60 loc) · 1.28 KB
/
test.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include <stdio.h>
#include "tp04.h"
int main()
{
root = NULL;
int choice=999;
int sayi;
int found;
while(choice)
{
printf(" \n");
printf(" Agaca sayi eklemek icin 1'e\n");
printf(" Agactan sayi silmek icin 2'e \n");
printf(" Agacta sayı aramak icin 3'e \n");
printf(" preorder icin 4'e \n");
printf(" postorder icin 5 'e \n");
printf(" inorder icin 6'ya \n");
printf(" Cikmak icin 0'a basiniz \n");
printf(" Input: ");scanf("%d",&choice);
switch(choice)
{
case 1:
printf("\n sayi: \n");
scanf("%d",&sayi);
root=sTreeInsert(root,sayi);
break;
case 2:
found=0;
printf("\n Silmek istediğiniz sayı: \n");
scanf("%d",&sayi);
root=deleteNode(root,sayi);
break;
case 3:
found=0;
printf("\n Aramak istediginiz sayi: \n");
scanf("%d",&sayi);
root=searchNode(root,sayi);
if(root && root->data == sayi)
printf("\n Sayi %d bulundu roota tasindi\n ",sayi);
else
printf("\n Sayi %d bulunamadi.\n",sayi);
break;
case 4:
printf("\n Preorder: ");
preorder(root);
printf("\n");
break;
case 5:
printf("\n Postorder: ");
postorder(root);
printf("\n");
break;
case 6:
printf("\n Inorder: ");
inorder(root);
printf("\n");
break;
}
}
}