Binary Tree findNums() ERROR

Hey Experts,

I have a problem with my code
I have a binary tree which in its nodes have elements from an unsorted array
and i have to create a method which will take two integers and print all the numbers from the binary tree which are between those numbers
Actually thats what i did:

public E findNums(int min, int max)
    {
        if (max > maximum())      
        {
            max = rootNode;
        }
        else if (min < minimum())
        {
            min = minimum();
        }
        else{
            if ((leftNode >= minimum()) || (leftNode <= max))
            {
                return leftNode;
            }
            else if((rightNode >= min) || (rightNode <=max))
            {
                return rightNode;
            }
            else
            {
                return null;
            }
        }
    }


If anyone knows how to solve my problem / correct my code it 'd be grateful
Thanks in advance!
         
perdoname_Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ozoCommented:
If your tree is sorted in inorder
public E findNums(int min, int max, Node root)
    {
        if( root == null ){ return; }
        if( root.data >= min ){
            public E findNums(int min, int max,root.leftNode);
            if( root.data <= max ){ System.out.println( root.data ); }
      }
        if( root.data <= max ){
            public E findNums(int min, int max,root.rightNode);

      }
}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
perdoname_Author Commented:
Thanks !!

but why during the compile it returns "illegal start of expression"   at the     " public E findNums(int min, int max, root.left(Node);" ???
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.