Results 1 to 2 of 2

Thread: red black tree

  1. #1
    ahmakki is offline Member
    Join Date
    Mar 2010
    Rep Power

    Question red black tree

    hello i have this method and i need someone to help me with it : validateEveryPathSameNumberOfBlack() , it validates that all paths in the tree contain the same number of black node starting from a specific node

  2. #2
    m00nchile is offline Senior Member
    Join Date
    Feb 2010
    Ljubljana, Slovenia
    Rep Power


    So, where exactely are you stuck? Since this operation has nothing to do with insertion or deletion of nodes, you can look at it as a normal binary tree, I'm guessing your method doesn't need to return values so a boolean should suffice, and the best way would be recursion. So, the algorithm would go, keep checking nodes of the left and right subtree of the current node, when you encounter a leaf check the number of black nodes passed on the way, this value should be the same for all leafs encountered.

Similar Threads

  1. Help required for black berry app development
    By khadaree in forum CLDC and MIDP
    Replies: 0
    Last Post: 03-08-2010, 12:04 PM
  2. Recognize Black Pixel of a Threshold Image
    By LankanSniper in forum Java 2D
    Replies: 1
    Last Post: 12-04-2009, 08:09 AM
  3. Red Black tree insertion
    By unicorn in forum New To Java
    Replies: 16
    Last Post: 11-03-2009, 06:46 PM
  4. Why this image background is black ?
    By samson in forum Java 2D
    Replies: 1
    Last Post: 07-17-2007, 05:24 AM
  5. Implementing a red-black tree in java
    By baltazar in forum New To Java
    Replies: 1
    Last Post: 07-13-2007, 09:37 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts