Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static int sommaPari(Albero a, int liv) {
- int somma = 0;
- if (liv % 2 == 0) {
- somma += a.val();
- }
- if (a.sx() != null) {
- somma += sommaPari(a.sx(), liv+1);
- }
- if (a.dx() != null) {
- somma += sommaPari(a.dx(), liv+1);
- }
- return somma;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement