Binary Tree

Binary tree implementation in java <<<<<<<<<<<<<<<<<BinaryTreeNode.java>>>>>>>>>>>>>>>>>>>>>>> public class BinaryTreeNode { private int key; private BinaryTreeNode leftLink; private BinaryTreeNode rightLink; public void setKey(int key) { this.key = key; } public int getKey() { return this.key; } public void setLeftLink(BinaryTreeNode bNode) { this.leftLink = bNode; } public void setRightLink(BinaryTreeNode bNode) { this.rightLink = bNode; } public BinaryTreeNode ...

Binary Search

Binary Search algorithm implementation in Java import java.io.Console; public class BinarySearch { static int[] numArr = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; public static void main(String args[]) { for (int i = 0; i < numArr.length; i++) { System.out.print(numArr[i] + "\t"); } System.out.println("\n"); System.out.print("Search? :"); Console con = System.console(); ...

Adding rows and columns in JTable dynamically 5

Adding rows and columns in JTable dynamically
Java Source code to add Row and Column in JTable dynamically package com.example; import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.Vector; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.WindowConstants; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; public class JTableSample { private JFrame mainFrame ; private JTable ...

Russian Peasant Multiplication 2

Russian Peasant Multiplication
Description: Russian Peasant Multiplication. This program allows one to do multiplication by just doing muliplication or division by 2 (and addition). This is interesting since computers generally use base 2 arithmetic.The algorithm is as follows. Start two rows, one with the multiplicand (say, A) and the other the multiplier (say B). The goal is to ...