gs gs121 Binary Trees - Binary Search Tree - Quiz No.1
gs gs121 Data Structures and Algorithms Quiz
This quiz belongs to book/course code gs gs121 Data Structures and Algorithms of gs organization. We have 169 quizzes available related to the book/course Data Structures and Algorithms. This quiz has a total of 10 multiple choice questions (MCQs) to prepare and belongs to topic Binary Trees. NVAEducation wants its users to help them learn in an easy way. For that purpose, you are free to prepare online MCQs and quizzes.
NVAEducation also facilitates users to contribute in online competitions with other students to make a challenging situation to learn in a creative way. You can create one to one, and group competition on an topic of a book/course code. Also on NVAEducation you can get certifications by passing the online quiz test.
public Tree search(Tree root, int key) { if( root == null || root.key == key ) { return root; } if( root.key < key ) { return search(root.right,key); } else return search(root.left,key); }
public Tree search(Tree root, int key) { if( root == null || root.key == key ) { return root; } if( root.key < key ) { return search(root.left,key); } else return search(root.right,key); }
public Tree search(Tree root, int key) { if( root == null) { return root; } if( root.key < key ) { return search(root.right,key); } else return search(root.left,key); }
public Tree search(Tree root, int key) { if( root == null) { return root; } if( root.key < key ) { return search(root.right.right,key); } else return search(root.left.left,key); }
public void func(Tree root) { func(root.left()); func(root.right()); System.out.println(root.data()); }
public void func(Tree root) { System.out.println(root.data()); func(root.left()); func(root.right()); }
public void min(Tree root) { while(root.left() != null) { root = root.left(); } System.out.println(root.data()); }
public void min(Tree root) { while(root != null) { root = root.left(); } System.out.println(root.data()); }
public void min(Tree root) { while(root.right() != null) { root = root.right(); } System.out.println(root.data()); }
public void min(Tree root) { while(root != null) { root = root.right(); } System.out.println(root.data()); }
public void max(Tree root) { while(root.left() != null) { root = root.left(); } System.out.println(root.data()); }
public void max(Tree root) { while(root != null) { root = root.left(); } System.out.println(root.data()); }
public void max(Tree root) { while(root.right() != null) { root = root.right(); } System.out.println(root.data()); }
public void max(Tree root) { while(root != null) { root = root.right(); } System.out.println(root.data()); }
public void lca(Tree root,int n1, int n2) { while (root != NULL) { if (root.data() > n1 && root.data() > n2) root = root.right(); else if (root.data() < n1 && root.data() < n2) root = root.left(); else break; } System.out.println(root.data()); }
public void lca(Tree root,int n1, int n2) { while (root != NULL) { if (root.data() > n1 && root.data() < n2) root = root.left(); else if (root.data() < n1 && root.data() > n2) root = root.right(); else break; } System.out.println(root.data()); }
public void lca(Tree root,int n1, int n2) { while (root != NULL) { if (root.data() > n1 && root.data() > n2) root = root.left(); else if (root.data() < n1 && root.data() < n2) root = root.right(); else break; } System.out.println(root.data()); }
public void lca(Tree root,int n1, int n2) { while (root != NULL) { if (root.data() > n1 && root.data() > n2) root = root.left.left(); else if (root.data() < n1 && root.data() < n2) root = root.right.right(); else break; } System.out.println(root.data()); }