Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.11 KB | None | 0 0
  1.   public void S(string wartosc)
  2.             {
  3.                 Node obecny = korzen;
  4.               while(true)
  5.                 {
  6.                     if (obecny == null)
  7.                     {
  8.                         Console.WriteLine("NIE");
  9.                         break;
  10.                     }
  11.                     if (cmp(wartosc, obecny.wartosc) == 0)
  12.                     {
  13.                         Console.WriteLine("TAK");
  14.                         break;
  15.                     }
  16.                     else if (cmp(wartosc, obecny.wartosc) < 0)
  17.                     {
  18.                         obecny = obecny.lewy;
  19.                     }
  20.                     else if (cmp(wartosc, obecny.wartosc) > 0)
  21.                     {
  22.                         obecny = obecny.prawy;
  23.                     }
  24.                     else if (obecny.lewy == null)
  25.                     {
  26.                         obecny = korzen;
  27.                     }
  28.                     else if (obecny.prawy == null)
  29.                     {
  30.                         obecny = korzen;
  31.                     }
  32.                    
  33.                 }
  34.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement