Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void S(string wartosc)
- {
- Node obecny = korzen;
- while(true)
- {
- if (obecny == null)
- {
- Console.WriteLine("NIE");
- break;
- }
- if (cmp(wartosc, obecny.wartosc) == 0)
- {
- Console.WriteLine("TAK");
- break;
- }
- else if (cmp(wartosc, obecny.wartosc) < 0)
- {
- obecny = obecny.lewy;
- }
- else if (cmp(wartosc, obecny.wartosc) > 0)
- {
- obecny = obecny.prawy;
- }
- else if (obecny.lewy == null)
- {
- obecny = korzen;
- }
- else if (obecny.prawy == null)
- {
- obecny = korzen;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement