java - Search for items in the BST satisfy several conditions -


in java algorithm , data structure books found how realize search method, there explanation on how find element key entered. it's not need

want search students in catalog satisfy several conditions, yeah, sounds easy, found little bit fiddly.

here code method

public node search() {     node current = root;      while (current != null || current.st.year != 2 && current.st.sex != "male" && current.st.result != 5)     {         if (current.st.id <= root.st.id)              current = current.leftchild;         else              current = current.rightchild;          if (current == null)              return null;     }      return current; } 


have classes student, node, bst.
st object of student class in node class access fields of student class.

actually, method returns elements situated @ left side. wrong it?


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -