Repository navigation
Expand file tree
/
Copy pathTree.c
More file actions
95 lines (71 loc) · 1.44 KB
/
Copy pathTree.c
File metadata and controls
95 lines (71 loc) · 1.44 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
* File: main.c
* Author: gilberto
*
* Created on 7 de Junho de 2015, 05:16
*/
#include <stdio.h>
#include <stdlib.h>
/*
*
*/
//Defines the base of main structure
struct tree{
int value;
int balance;
struct tree *left;
struct tree *right;
};
//Defines 'node' as a type
typedef struct tree node;
int main(int argc, char** argv) {
return (EXIT_SUCCESS);
}
//Function that initialize the tree
node *start(void){
node *head;
head = malloc(sizeof(node));
head->balance = 0;
head->left = NULL;
head->right = NULL;
}
//Incial Menu
int menu(void){
int option;
do{
printf("\t===== MENU =====\n");
printf("\t1 - INSERT\n");
printf("\t2 - PRINT\n");
printf("\t3 - EXIT\n");
scanf("%d", &option);
}while(option < 1 && option > 3);
getchar();
return option;
}
//Insert function
void insert(node *root){
node *father, *aux;
father = root;
}
//Simple left rotation
void simpleLeft(node *root){
node *r_aux, *f_aux;
r_aux = root->right;
f_aux = root;
r_aux->left = f_aux;
f_aux->right = NULL;
}
//Simple right rotation
void simpleRight(node *root){
node *l_aux, *f_aux;
l_aux = root->left;
f_aux = root;
l_aux->right = f_aux;
f_aux->left = NULL;
}
//Double left rotation
void doubleLeft(node *root){
}
//Double right rotation
void doubleRight(node *root){
}