├── README.md ├── R └── Data structures using R.pdf ├── Array_implementaion_of_stack_ADT.cpp ├── Array_implementation_of_queue_ADT.cpp └── Array_implementation_of_list_adt.cpp /README.md: -------------------------------------------------------------------------------- 1 | # Data-structures -------------------------------------------------------------------------------- /R/Data structures using R.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BarathkumarJK/Data-structures/HEAD/R/Data structures using R.pdf -------------------------------------------------------------------------------- /Array_implementaion_of_stack_ADT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std 5 | 6 | class stack { 7 | int stk[5]; 8 | int top; 9 | public: 10 | stack(){ 11 | top=-1; 12 | } 13 | void push(int x){ 14 | if(top>4){ 15 | cout<<"stack overflow"; 16 | return; 17 | } 18 | stk[++top]=x; 19 | cout<<"inserted"<=0;i--) 36 | cout<>ch; 45 | switch(ch){ 46 | case 1:cout<<"Enter the Element"; 47 | cin>>ch; 48 | st.push(ch); 49 | break; 50 | 51 | case 2:st.pop(); 52 | break; 53 | 54 | case 3: st.display(); 55 | break; 56 | 57 | case 4: exit(0); 58 | } 59 | } 60 | return 0; 61 | } 62 | -------------------------------------------------------------------------------- /Array_implementation_of_queue_ADT.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | using namespace std; 5 | class queue{ 6 | int queue1[5]; 7 | int rear,front,public; 8 | queue(){ 9 | rear = -1; 10 | front = -1; 11 | } 12 | void insert(int x){ 13 | if(rear > 4){ 14 | cout<<"queue over flow"; 15 | front = rear = -1; 16 | return; 17 | } 18 | queue1[++rear]=x; 19 | cout<<"inserted"<>ch; 40 | switch(ch){ 41 | case 1:cout<<"enter the element"; 42 | cin>>ch; 43 | qu.insert(ch); 44 | break; 45 | 46 | case 2:qu.delete(); 47 | break; 48 | 49 | case 3:qu.diplay(); 50 | break; 51 | 52 | case 4: exit(0); 53 | } 54 | } 55 | return 0; 56 | } -------------------------------------------------------------------------------- /Array_implementation_of_list_adt.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | void create(); 3 | void insert(); 4 | void deletion(); 5 | void search(); 6 | void display(); 7 | 8 | int a,b[20],n,d,e,f,i; 9 | 10 | int main(){ 11 | int c; 12 | char g='y'; 13 | do{ 14 | cout<<"\n Main Menu"; 15 | cout<<"\n 1.Create \n 2.Delete \n 3.Search \n 4.insert \n 5.Display \n 6.Exit"; 16 | cout<<"\n Enter your choice\n"; 17 | switch(c) 18 | { 19 | case 1: create(); break; 20 | case 2: deletion(); break; 21 | case 3: search(); break; 22 | case 4: insert(); break; 23 | case 5: display(); break; 24 | case 6: exit(0); break; 25 | default: 26 | cout<<"The given number is not between 1-5\n" 27 | } 28 | cout<<"\nDo You wannt to continue \n"; 29 | cin>>g; 30 | clrscr(); 31 | } 32 | while(g=='y'||g=='Y'); 33 | getch(); 34 | } 35 | void create(){ 36 | cout<<"\n Enter the number \n"; 37 | cin>>n; 38 | for( i=0; i>b[i]; 40 | } 41 | } 42 | void deletion() 43 | { 44 | cout<<"Enter the limit you want to delete \n"; 45 | cin>>d; 46 | for( i=0; i>e; 55 | for( i=0; i>f; 65 | for( i=0; i>b[n++]; 67 | } 68 | } 69 | 70 | void display(){ 71 | cout<<"\n\n\n"; 72 | for( i=0; i