Advertisement
shamiul93

Main

Jan 9th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1.  
  2. int main()
  3. {
  4.     Nil = new Node(NilValue);
  5.  
  6.  
  7.     /// ***** Do your Code Here***** ///
  8.  
  9.     RedBlackTree t ;
  10.     ll a ;
  11.     while(1)
  12.     {
  13.         ll c ;
  14.         cout << "1. Insert \n2. Delete" << endl ;
  15.         cin >> c >> a;
  16.         Node *n ;
  17.         n = new Node(a);
  18.         if(c == 1)
  19.         {t.Insert(n);}
  20.         else if(c==2)
  21.         {
  22.             t.RBdelete(t.Search(a));
  23.         }
  24.         cout << "Success" << endl << endl  ;
  25.  
  26.         cout << "Asc Print: " ;
  27.         t.AscPrint(t.Root);
  28.         cout << endl ;
  29.  
  30.         cout << "Min: " <<  t.RBmin(t.Root)->Value << endl ;
  31.         cout << "Max: " <<  t.RBmax(t.Root)->Value << endl ;
  32.     }
  33.     return 0 ;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement