Advertisement
elica123

2.zadatak(b)-2015

Nov 29th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1.  
  2. int zbrojiPretke(node k, node l, BinaryTree T) {
  3. int zbroj = 0;
  4. node prvi = prviPredak(k, l, T); //nadjimo prvog pretka
  5. node k1 = BiParent(k, T);
  6. while (k1 != prvi) { //penjemo se po pretcima od k do prvo pretka
  7. zbroj += BiLabel(k1, T); //usput sve zbrajamo
  8. k1 = BiParent(k1, T);
  9. }
  10. node l1 = BiParent(l, T);
  11. while (l1 != prvi) { //isto sa cvorom l
  12. zbroj += BiLabel(l1, T);
  13. l1 = BiParent(l1, T);
  14. return zbroj;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement