1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | import java.util.Scanner; class BST { static BST.Node root = null; public void insert(int num) { if (root == null) { root = new BST.Node(num); } else {// root node is not empty BST.Node temp = root; while (temp != null) { if (num <= temp.getVal()) { if (temp.getLeft() != null) temp = temp.getLeft(); else { temp.setLeft(new Node(num)); break; } } else { if (temp.getRight() != null) temp = temp.getRight(); else { temp.setRight(new Node(num)); break; } } } } } public void search(int num, Node root) { if (root == null) { System.out.println("Number is not present "); return; } if (root.getVal() == num) { System.out.println("Number is present "); } else { if (num < root.getVal()) search(num, root.getLeft()); else search(num, root.getRight()); } } public void display(Node root) { if (root == null) return; display(root.getLeft()); System.out.println(" " + root.getVal() + " "); display(root.getRight()); } public static void main(String[] args) { BST bst= new BST(); byte choice = 0; while (choice != 4) { int num; Scanner in = new Scanner(System.in); System.out.print("\nPress \n1 to insert \n2. To search \n3. Display \n4 to exit->"); choice = in.nextByte(); switch (choice) { case 1: System.out.print("Enter the number ->"); num = in.nextInt(); bst.insert(num); break; case 2: System.out.print("Enter the Number "); num = in.nextInt(); bst.search(num, root); break; case 3: bst.display(root); } } } private static class Node { private int val; private Node left = null; private Node right = null; public Node(int i) { this.val = i; } public int getVal() { return val; } public void setVal(int val) { this.val = val; } public Node getLeft() { return left; } public void setLeft(Node left) { this.left = left; } public Node getRight() { return right; } public void setRight(Node right) { this.right = right; } } } |
Adsense is used by majority of expert bloggers for their website monetization because it is a cookie based contextual advertising system that shows targeted ads relevant to the content and reader. As bloggers are paid on per click basis, they try various ad placements on the blog to increase the revenue and get maximum clicks on the ad units. Well, on some blogs, you might have seen Adsense ad units placed below the post title. Do you know why? It is because the area just below the post title gets the most exposure and is the best place to put AdSense ad units to increase Click Through Rate (CTR). Even though ads below post title work like a charm but this doesn’t mean that it will work for you as well. If you want to find out the best AdSense ads placement for your blog, try experimenting by placing ads at various locations such as header, sidebar, footer, etc. You can try other blog monetization methods as well to effectively monetize y...
Your Affiliate Profit Machine is waiting -
ReplyDeletePlus, making profit with it is as easy as 1..2..3!
Here are the steps to make it work...
STEP 1. Input into the system what affiliate products the system will advertise
STEP 2. Add push button traffic (it takes JUST 2 minutes)
STEP 3. Watch the system grow your list and up-sell your affiliate products for you!
Are you ready to make money ONLINE???
Click here to activate the system
Did you realize there is a 12 word phrase you can tell your crush... that will trigger intense emotions of love and impulsive attraction to you buried within his chest?
ReplyDeleteThat's because hidden in these 12 words is a "secret signal" that triggers a man's impulse to love, look after and guard you with his entire heart...
12 Words Who Fuel A Man's Love Response
This impulse is so hardwired into a man's mind that it will drive him to try harder than ever before to make your relationship as strong as it can be.
In fact, triggering this powerful impulse is so essential to getting the best ever relationship with your man that the instance you send your man one of these "Secret Signals"...
...You will immediately find him expose his soul and mind for you in a way he's never expressed before and he will distinguish you as the one and only woman in the galaxy who has ever truly appealed to him.
According to Stanford Medical, It's really the one and ONLY reason this country's women get to live 10 years longer and weigh 19 KG lighter than we do.
ReplyDelete(And actually, it has totally NOTHING to do with genetics or some secret-exercise and really, EVERYTHING about "HOW" they are eating.)
BTW, I said "HOW", and not "WHAT"...
Tap this link to see if this brief questionnaire can help you discover your true weight loss possibilities
Your Affiliate Money Making Machine is waiting -
ReplyDeletePlus, making profit with it is as simple as 1-2-3!
This is how it all works...
STEP 1. Choose affiliate products you want to promote
STEP 2. Add some PUSH button traffic (it takes JUST 2 minutes)
STEP 3. Watch the affiliate system explode your list and upsell your affiliate products all for you!
Are you ready to make money automatically??
Get the full details here