-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
154 lines (148 loc) · 2.78 KB
/
main.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#include<stdio.h>
//#include "set/set.h"
//#include "map/map.h"
//#include "vector/vector.h"
//#include "stack/stack.h"
#include "queue/queue.h"
//void print(vec* hash,map* hash2){
// if(hash==NULL)
// printf("NULL\n");
// vec* temp=hash;
// while(temp!=NULL){
// printf("\n%d",M_search(hash2,temp->val));
// temp=temp->next;
// }
//}
//
//void revPrint(vec* hash){
// while(hash!=NULL){
// printf("%d",hash->val);
// hash=hash->prev;
// }
//}
//
//void ForVector(){
// vec* hash=NULL;
// push_front(&hash,1);
// push_front(&hash,2);
// push_front(&hash,3);
// push_front(&hash,4);
// print(hash);
// printf("\n");
// vec* hash2=reverse(&hash);
// vec* t=find(&hash2,1);
// push_front(&hash2,0);
// clean(&hash);
// clean(&hash2);
// print(hash2);
//}
//
//void ForSet(){
// tree* hash=NULL;
// int t=1;
// int val=0;
// vec* temp=NULL;
// while(t){
// printf("1 ADD and 2 Delete\n");
// int ch;
// scanf("%d",&ch);
// switch(ch){
// case 1:val=0;
// printf("Enter value\n");
// scanf("%d",&val);
// add(&hash,val);
// break;
// case 2:
// val=0;
// printf("Enter value\n");
// scanf("%d",&val);
// eraseT(&hash,val);
// break;
// case 3:preorder(hash);
// break;
// case 4:printf("\n enter the value to be searched\n");
// scanf("%d",&val);
// tree* it=search(hash,val);
// if(it==NULL)
// printf("Not found\n");
// else
// printf("Found\n");
// break;
// case 5:destroy(&hash);
// break;
// case 6:temp=Itr(hash);
// print(temp);
// break;
// default:printf("Wrong choice\n");
// }
// printf("\n1. Contine 0. exit");
// scanf("%d,",&t);
// printf("\n");
// }
// destroy(&hash);
//}
//
//void test(){
// tree* hash=NULL;
// add(&hash,63);
// add(&hash,9);
// add(&hash,19);
// add(&hash,27);
// add(&hash,18);
// add(&hash,108);
// add(&hash,99);
// add(&hash,81);
// preorder(hash);
//}
//void ForStack(){
// st* t=NULL; ForQueue();
// popElement(&t);
// pushElement(&t,1);
// pushElement(&t,2);
// pushElement(&t,3);
// pushElement(&t,4);
// pushElement(&t,5);
// popElement(&t);
// printf("%d\n",getTop(&t));
// pushElement(&t,6);
// printf("%d\n",getTop(&t));
// while(t!=NULL){
// printf("%d ",getTop(&t));
// popElement(&t);
// }
//}
void ForQueue(){
qu* t;
pushFront(&t,1);
pushFront(&t,2);
pushFront(&t,3);
pushFront(&t,4);
// while(t!=NULL){
// printf("%d ",getFront(&t));
// popBack(&t);
// }
pushFront(&t,5);
popBack(&t);
pushFront(&t,6);
printf("%d",getFront(&t));
while(t!=NULL){
printf("%d ",getFront(&t));
popBack(&t);
}
}
int main(){
// ForVector();
// ForSet();
// test();
printf("It works");
// map* hash=NULL;
// M_add(&hash,1,10);
// M_add(&hash,2,11);
// M_add(&hash,3,12);
// M_eraseT(&hash,3);
// vec* hash1=M_Itr(hash);
// print(hash1,hash);
// M_destroy(&hash);
// ForStack();
// ForQueue();
}