Let us check the values of nextRight pointers
int a = tree . root . nextRight != null ? tree . root . nextRight . data : - 1 ; int b = tree . root . left . nextRight != null ? tree . root . left . nextRight . data : - 1 ; int c = tree . root . right . nextRight != null ? tree . root . right . nextRight . data : - 1 ; int d = tree . root . left . left . nextRight != null ? tree . root . left . left . nextRight . data : - 1 ; int e = tree . root . right . right . nextRight != null ? tree . root . right . right . nextRight . data : - 1 ; Console . WriteLine ( " Following ▁ are ▁ populated ▁ nextRight ▁ pointers ▁ in ▁ " + " ▁ the ▁ tree ( -1 ▁ is ▁ printed ▁ if ▁ there ▁ is ▁ no ▁ nextRight ) " ) ; Console . WriteLine ( " nextRight ▁ of ▁ " + tree . root . data + " ▁ is ▁ " + a ) ; Console . WriteLine ( " nextRight ▁ of ▁ " + tree . root . left . data + " ▁ is ▁ " + b ) ; Console . WriteLine ( " nextRight ▁ of ▁ " + tree . root . right . data + " ▁ is ▁ " + c ) ; Console . WriteLine ( " nextRight ▁ of ▁ " + tree . root . left . left . data + " ▁ is ▁ " + d ) ; Console . WriteLine ( " nextRight ▁ of ▁ " + tree . root . right . right . data + " ▁ is ▁ " + e ) ; } }