diff --git a/ATM.java b/ATM.java
new file mode 100644
index 0000000..e0ed7af
--- /dev/null
+++ b/ATM.java
@@ -0,0 +1,20 @@
+import java.util.*;
+import java.lang.*;
+import java.io.*;
+
+/* Name of the class has to be "Main" only if the class is public. */
+class Codechef
+{
+ public static void main (String[] args) throws java.lang.Exception
+ {
+ Scanner sc = new Scanner(System.in);
+ double withdrawl_bal = sc.nextDouble();
+ double curr_bal = sc.nextDouble();
+
+ if (withdrawl_bal % 5 == 0 && curr_bal >= withdrawl_bal + 0.5){
+ curr_bal = curr_bal - (withdrawl_bal + 0.5);
+ }
+ // your code goes here
+ System.out.printf("%.2f",curr_bal);
+ }
+}
diff --git a/AWT/Behaviour/ActionListenerDemo.java b/AWT/Behaviour/ActionListenerDemo.java
new file mode 100755
index 0000000..02c0c5c
--- /dev/null
+++ b/AWT/Behaviour/ActionListenerDemo.java
@@ -0,0 +1,26 @@
+import java.awt.*;
+import java.awt.event.*;
+
+public class ActionListenerDemo extends Frame implements ActionListener {
+ Button b;
+ Label l;
+ ActionListenerDemo() {
+ b = new Button("Buttom");
+ l = new Label("Click it!");
+ Image icon = Toolkit.getDefaultToolkit().getImage("../icon.png");
+ setIconImage(icon);
+ setTitle("ActionDemo.java");
+ setSize(420, 420);
+ setLayout(new FlowLayout(FlowLayout.CENTER));
+ b.addActionListener(this);
+ add(b);
+ add(l);
+ setVisible(true);
+ }
+ public void actionPerformed(ActionEvent ae) {
+ l.setText("Clicked " + ae.getActionCommand());
+ }
+ public static void main(String[] args) {
+ new ActionListenerDemo();
+ }
+}
\ No newline at end of file
diff --git a/AWT/Behaviour/AdapterTest.java b/AWT/Behaviour/AdapterTest.java
new file mode 100755
index 0000000..78409de
--- /dev/null
+++ b/AWT/Behaviour/AdapterTest.java
@@ -0,0 +1,22 @@
+import java.awt.*;
+import java.awt.event.*;
+
+public class AdapterTest extends MouseAdapter {
+ AdapterTest() {
+ Frame frame = new Frame();
+ Image icon = Toolkit.getDefaultToolkit().getImage("../icon.png");
+ frame.setIconImage(icon);
+ frame.setTitle("AdapterTest.java");
+ frame.setSize(420, 420);
+ frame.addMouseListener(this);
+ frame.setVisible(true);
+ }
+
+ public void mouseClicked(MouseEvent me) {
+ System.out.println("Mouse Clicked");
+ }
+
+ public static void main(String[] args) {
+ new AdapterTest();
+ }
+}
\ No newline at end of file
diff --git a/AWT/Behaviour/KeyListenerDemo.java b/AWT/Behaviour/KeyListenerDemo.java
new file mode 100755
index 0000000..0e10a79
--- /dev/null
+++ b/AWT/Behaviour/KeyListenerDemo.java
@@ -0,0 +1,34 @@
+import java.awt.*;
+import java.awt.event.*;
+
+public class KeyListenerDemo extends Frame implements KeyListener {
+ TextField textField;
+
+ KeyListenerDemo() {
+ Image icon = Toolkit.getDefaultToolkit().getImage("../icon.png");
+ setIconImage(icon);
+ setTitle("KeyListenerDemo.java");
+ setSize(420, 420);
+ setLayout(new FlowLayout(FlowLayout.LEFT));
+ textField = new TextField(25);
+ textField.addKeyListener(this);
+ add(textField);
+ setVisible(true);
+ }
+
+ public void keyPressed(KeyEvent ke) {
+ System.out.println("KeyPressed = " + ke.getKeyChar());
+ }
+
+ public void keyReleased(KeyEvent ke) {
+ System.out.println("KeyReleased = " + ke.getKeyChar());
+ }
+
+ public void keyTyped(KeyEvent ke) {
+ System.out.println("KeyTyped = " + ke.getKeyChar());
+ }
+
+ public static void main(String[] args) {
+ new KeyListenerDemo();
+ }
+}
\ No newline at end of file
diff --git a/AWT/Behaviour/MouseListenerDemo.java b/AWT/Behaviour/MouseListenerDemo.java
new file mode 100755
index 0000000..bbf10a4
--- /dev/null
+++ b/AWT/Behaviour/MouseListenerDemo.java
@@ -0,0 +1,33 @@
+import java.awt.*;
+import java.awt.event.*;
+
+public class MouseListenerDemo extends Frame implements MouseListener {
+ MouseListenerDemo() {
+ Image icon = Toolkit.getDefaultToolkit().getImage("../icon.png");
+ setIconImage(icon);
+ setTitle("MouseListenerDemo.java");
+ setSize(420, 420);
+ addMouseListener(this);
+ setVisible(true);
+ }
+
+ public void mouseEntered(MouseEvent me) {
+ System.out.println("Mouse Entered");
+ }
+ public void mousePressed(MouseEvent me) {
+ System.out.println("Mouse Pressed");
+ }
+ public void mouseReleased(MouseEvent me) {
+ System.out.println("Mouse Released");
+ }
+ public void mouseClicked(MouseEvent me) {
+ System.out.println("Mouse Clicked");
+ }
+ public void mouseExited(MouseEvent me) {
+ System.out.println("Mouse Exited");
+ }
+
+ public static void main(String[] args) {
+ new MouseListenerDemo();
+ }
+}
\ No newline at end of file
diff --git a/AWT/Behaviour/MouseMotionListenerDemo.java b/AWT/Behaviour/MouseMotionListenerDemo.java
new file mode 100755
index 0000000..916f8d0
--- /dev/null
+++ b/AWT/Behaviour/MouseMotionListenerDemo.java
@@ -0,0 +1,30 @@
+import java.awt.*;
+import java.awt.event.*;
+
+public class MouseMotionListenerDemo extends Frame implements MouseMotionListener {
+ Label label;
+ int x, y;
+
+ MouseMotionListenerDemo() {
+ Image icon = Toolkit.getDefaultToolkit().getImage("../icon.png");
+ setIconImage(icon);
+ setTitle("MouseMotionListenerDemo.java");
+ setSize(420, 420);
+ setLayout(new FlowLayout());
+ label = new Label("(Coordinates)");
+ add(label);
+ addMouseMotionListener(this);
+ setVisible(true);
+ }
+
+ public void mouseMoved(MouseEvent me) {
+ x = me.getX();
+ y = me.getY();
+ label.setText("(" + x + ", " + y + ")");
+ }
+ public void mouseDragged(MouseEvent me) {} // Compulsory to override
+
+ public static void main(String[] args) {
+ new MouseMotionListenerDemo();
+ }
+}
\ No newline at end of file
diff --git a/AWT/Behaviour/WindowListenerDemo.java b/AWT/Behaviour/WindowListenerDemo.java
new file mode 100755
index 0000000..66da926
--- /dev/null
+++ b/AWT/Behaviour/WindowListenerDemo.java
@@ -0,0 +1,40 @@
+import java.awt.*;
+import java.awt.event.*;
+
+public class WindowListenerDemo extends Frame implements WindowListener {
+ WindowListenerDemo() {
+ Image icon = Toolkit.getDefaultToolkit().getImage("../icon.png");
+ setIconImage(icon);
+ setTitle("WindowListenerDemo.java");
+ setSize(420, 420);
+ addWindowListener(this);
+ setVisible(true);
+ }
+
+ public void windowOpened(WindowEvent we) {
+ System.out.println("Window Opened");
+ }
+ public void windowClosing(WindowEvent we) {
+ System.out.println("Window Closing");
+ System.exit(0);
+ }
+ public void windowClosed(WindowEvent we) {
+ System.out.println("Window Closed");
+ }
+ public void windowIconified(WindowEvent we) {
+ System.out.println("Window Iconified");
+ }
+ public void windowDeiconified(WindowEvent we) {
+ System.out.println("Window Deiconified");
+ }
+ public void windowActivated(WindowEvent we) {
+ System.out.println("Window Activated");
+ }
+ public void windowDeactivated(WindowEvent we) {
+ System.out.println("Window Deactivated");
+ }
+
+ public static void main(String[] args) {
+ new WindowListenerDemo();
+ }
+}
\ No newline at end of file
diff --git a/AWT/FirstCanvas.java b/AWT/FirstCanvas.java
new file mode 100755
index 0000000..dd33952
--- /dev/null
+++ b/AWT/FirstCanvas.java
@@ -0,0 +1,30 @@
+import java.awt.*;
+
+public class FirstCanvas {
+ Frame f1;
+ Label l1;
+ Panel p1;
+
+ FirstCanvas() {
+ f1 = new Frame("FirstCanvas.java");
+ f1.setSize(420, 420);
+ f1.setLayout(new GridLayout(3, 1));
+ l1 = new Label();
+ p1 = new Panel();
+ f1.add(l1);
+ f1.add(p1);
+
+ l1.setText("Canvas");
+ Canvas c = new Canvas();
+ c.setSize(69, 69);
+ c.setBackground(Color.GRAY);
+ // f1.add(c);
+ p1.add(c);
+
+ f1.setVisible(true);
+ }
+
+ public static void main(String[] args) {
+ FirstCanvas canvas = new FirstCanvas();
+ }
+}
\ No newline at end of file
diff --git a/AWT/FirstFrame.java b/AWT/FirstFrame.java
new file mode 100755
index 0000000..6f8bdb4
--- /dev/null
+++ b/AWT/FirstFrame.java
@@ -0,0 +1,9 @@
+import java.awt.*;
+
+public class FirstFrame {
+ public static void main(String[] args) {
+ Frame f = new Frame("FirstFrame.java");
+ f.setSize(420, 69);
+ f.setVisible(true);
+ }
+}
\ No newline at end of file
diff --git a/AWT/FrameFromApplet.java b/AWT/FrameFromApplet.java
new file mode 100755
index 0000000..3668123
--- /dev/null
+++ b/AWT/FrameFromApplet.java
@@ -0,0 +1,46 @@
+//
+
+import java.applet.Applet;
+import java.awt.*;
+
+class MyFrame extends Frame {
+ MyFrame(String title) {
+ // super(title); // Only needed if want to set properties like this (title in this case)
+ setTitle(title);
+
+ // Label l = new Label("Frame");
+ // l.setAlignment(Label.CENTER);
+ // add(l);
+
+ // setVisible(true); // NOT NEEDED
+ }
+ public void paint(Graphics g) {
+ g.drawString("Frame", 69, 69);
+ }
+}
+
+public class FrameFromApplet extends Applet{
+ Frame f;
+ public void init() {
+ f = new MyFrame("FrameFromApplet.java");
+ f.setSize(420, 420);
+ // f.setVisible(true); // NOT NEEDED
+ }
+ public void start() {
+ f.setVisible(true);
+ }
+ public void stop() {
+ f.setVisible(false);
+ }
+ public void paint(Graphics g) {
+ g.drawString("from Applet", 9, 20);
+ }
+}
\ No newline at end of file
diff --git a/AWT/FrameTest.java b/AWT/FrameTest.java
new file mode 100755
index 0000000..aaa742e
--- /dev/null
+++ b/AWT/FrameTest.java
@@ -0,0 +1,13 @@
+import java.awt.*;
+
+public class FrameTest extends Frame{
+ FrameTest(String title) {
+ super(); // Calling the super class constructor (Frame)
+ this.setTitle(title);
+ this.setSize(420, 420);
+ this.setVisible(true);
+ }
+ public static void main(String[] args) {
+ FrameTest f = new FrameTest("FrameTest.java");
+ }
+}
\ No newline at end of file
diff --git a/AWT/HelloWorldFrame.java b/AWT/HelloWorldFrame.java
new file mode 100755
index 0000000..a04250e
--- /dev/null
+++ b/AWT/HelloWorldFrame.java
@@ -0,0 +1,19 @@
+import java.awt.*;
+
+class TestFrame extends Frame {
+ TestFrame(String title) {
+ // super();
+ setTitle(title);
+ setSize(420, 420);
+ Label l1 = new Label("Hello World!!");
+ l1.setAlignment(Label.CENTER);
+ add(l1);
+ setVisible(true);
+ }
+}
+
+public class HelloWorldFrame {
+ public static void main(String[] args) {
+ TestFrame f1 = new TestFrame("TestFrame.java");
+ }
+}
\ No newline at end of file
diff --git a/AWT/Layouts/BorderLayoutExample.java b/AWT/Layouts/BorderLayoutExample.java
new file mode 100755
index 0000000..c7729d6
--- /dev/null
+++ b/AWT/Layouts/BorderLayoutExample.java
@@ -0,0 +1,19 @@
+import java.awt.*;
+
+public class BorderLayoutExample {
+ public static void main(String[] args) {
+ Frame frame = new Frame("BorderLayoutExample.java");
+ Image icon = Toolkit.getDefaultToolkit().getImage("../icon.png");
+ frame.setIconImage(icon);
+ frame.setLayout(new BorderLayout(10, 5)); // Default in Frame class // hGap == vGap == 5
+ frame.setSize(420, 420);
+ frame.add(new Button("One"), BorderLayout.NORTH);
+ frame.add(new Button("Two"), BorderLayout.EAST);
+ frame.add(new Button("Three"), BorderLayout.WEST);
+ frame.add(new Button("Four"), BorderLayout.SOUTH);
+ frame.add(new Button("Five"), BorderLayout.CENTER);
+ frame.add(new Button("Six"), BorderLayout.SOUTH);
+
+ frame.setVisible(true);
+ }
+}
\ No newline at end of file
diff --git a/AWT/Layouts/CardLayoutExample.java b/AWT/Layouts/CardLayoutExample.java
new file mode 100755
index 0000000..587630a
--- /dev/null
+++ b/AWT/Layouts/CardLayoutExample.java
@@ -0,0 +1,49 @@
+import java.awt.*;
+import java.awt.event.*;
+
+public class CardLayoutExample implements ActionListener{
+ Frame frame = new Frame("CardLayoutExample.java");
+ CardLayout card = new CardLayout();
+ CardLayoutExample() {
+ frame.setLayout(card);
+ frame.setSize(420, 420);
+ Image icon = Toolkit.getDefaultToolkit().getImage("../icon.png");
+ frame.setIconImage(icon);
+
+ Button b1 = new Button("One");
+ b1.addActionListener(this);
+ frame.add(b1);
+
+ Button b2 = new Button("Two");
+ b2.addActionListener(this);
+ frame.add(b2);
+
+ Button b3 = new Button("Three");
+ b3.addActionListener(this);
+ frame.add(b3, "Three");
+
+ Button b4 = new Button("Four");
+ b4.addActionListener(this);
+ frame.add(b4);
+
+ Button b5 = new Button("Five");
+ b5.addActionListener(this);
+ frame.add(b5);
+
+ card.show(frame, "Three"); // TODO: WTF does this do!?
+ card.setHgap(5);
+ System.out.println("card.getHgap() = " + card.getHgap());
+ card.setVgap(5);
+ System.out.println("card.getVgap() = " + card.getVgap());
+ frame.setVisible(true);
+ }
+ public void actionPerformed(ActionEvent ae){
+ // card.first(frame); // Method 1
+ // card.last(frame); // Method 2
+ card.next(frame); // Method 3
+ // card.previous(frame); // Method 4
+ }
+ public static void main(String[] args) {
+ CardLayoutExample cL = new CardLayoutExample();
+ }
+}
\ No newline at end of file
diff --git a/AWT/Layouts/FlowLayoutExample.java b/AWT/Layouts/FlowLayoutExample.java
new file mode 100755
index 0000000..cffbf06
--- /dev/null
+++ b/AWT/Layouts/FlowLayoutExample.java
@@ -0,0 +1,20 @@
+import java.awt.*;
+
+public class FlowLayoutExample {
+ public static void main(String[] args) {
+ Frame frame = new Frame("FlowLayoutExample.java");
+ Image icon = Toolkit.getDefaultToolkit().getImage("../icon.png");
+ frame.setIconImage(icon);
+ frame.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 5)); // Default in Container class // hGap == vGap == 5
+ frame.setSize(420, 420);
+ frame.add(new Button("One"));
+ frame.add(new Button("Two"));
+ frame.add(new Button("Three"));
+ frame.add(new Button("Four"));
+ frame.add(new Button("Five"));
+ frame.add(new Button("Six"));
+ frame.add(new Button("Seven"));
+
+ frame.setVisible(true);
+ }
+}
\ No newline at end of file
diff --git a/AWT/Layouts/GridLayoutExample.java b/AWT/Layouts/GridLayoutExample.java
new file mode 100755
index 0000000..1925fd7
--- /dev/null
+++ b/AWT/Layouts/GridLayoutExample.java
@@ -0,0 +1,19 @@
+import java.awt.*;
+
+public class GridLayoutExample {
+ public static void main(String[] args) {
+ Frame frame = new Frame("GridLayoutExample.java");
+ Image icon = Toolkit.getDefaultToolkit().getImage("../icon.png");
+ frame.setIconImage(icon);
+ frame.setLayout(new GridLayout(3/*Rows*/, 2/*Columns*/)); // 0 is allowed but not both(IllegalArgumentException)
+ frame.setSize(420, 420);
+ frame.add(new Button("One"));
+ frame.add(new Button("Two"));
+ frame.add(new Button("Three"));
+ frame.add(new Button("Four"));
+ frame.add(new Button("Five"));
+ frame.add(new Button("Six"));
+
+ frame.setVisible(true);
+ }
+}
\ No newline at end of file
diff --git a/AWT/SecondCanvas.java b/AWT/SecondCanvas.java
new file mode 100755
index 0000000..a7ba3b8
--- /dev/null
+++ b/AWT/SecondCanvas.java
@@ -0,0 +1,40 @@
+import java.awt.*;
+
+class MyCanvas extends Canvas {
+ MyCanvas() {
+ setSize(169, 169);
+ setBackground(Color.GRAY);
+ }
+ public void paint(Graphics g) {
+ g.drawString("Hello", 10, 10);
+ }
+}
+
+public class SecondCanvas {
+ Frame f1;
+ Label l1;
+ Panel p1;
+
+ SecondCanvas() {
+ f1 = new Frame("SecondCanvas.java");
+ f1.setSize(420, 420);
+ f1.setLayout(new GridLayout(3, 1));
+ l1 = new Label();
+ p1 = new Panel();
+ f1.add(l1);
+ f1.add(p1);
+ f1.setVisible(true);
+ }
+
+ public void showCanvas() {
+ l1.setText("Canvas");
+ Canvas c = new MyCanvas();
+ p1.add(c);
+ f1.setVisible(true);
+ }
+
+ public static void main(String[] args) {
+ SecondCanvas canvas = new SecondCanvas();
+ canvas.showCanvas();
+ }
+}
\ No newline at end of file
diff --git a/AWT/SwingExample.java b/AWT/SwingExample.java
new file mode 100755
index 0000000..9c9e505
--- /dev/null
+++ b/AWT/SwingExample.java
@@ -0,0 +1,21 @@
+import java.awt.*;
+import javax.swing.*;
+
+public class SwingExample {
+ public static void main(String[] args) {
+ JFrame jFrame = new JFrame("SwingExample.java");
+ jFrame.setSize(420, 420);
+ JPanel jPanel = new JPanel();
+ jFrame.add(jPanel);
+ jPanel.add(new JTextField(25));
+ jPanel.add(new JButton("Buttom"));
+ JList jList = new JList();
+ // jList.add("item 1"); // This doesn't work
+ // jList.add("item 2"); // This doesn't work
+ // jList.add("item 3"); // This doesn't work
+ // jList.add("item 4"); // This doesn't work
+ // jList.add("item 5"); // This doesn't work
+ jPanel.add(jList);
+ jFrame.setVisible(true);
+ }
+}
\ No newline at end of file
diff --git a/AWT/TrafficLight.java b/AWT/TrafficLight.java
new file mode 100644
index 0000000..acc435d
--- /dev/null
+++ b/AWT/TrafficLight.java
@@ -0,0 +1,89 @@
+import java.awt.*;
+import javax.swing.*;
+import java.awt.event.*;
+
+class Signal extends JPanel{
+ Color on;
+ boolean change;
+ Signal(Color color){
+ on=color;
+ change=false;
+ }
+ public void turnOn(boolean a){
+ change=a;
+ repaint();
+ }
+ public Dimension getPreferredSize(){
+ int size=(50)*2;
+ return new Dimension(size,size);
+ }
+ public void paintComponent(Graphics g){
+ g.setColor(Color.black);
+ g.fillRect(0,0,150,250);
+ if(change){
+ g.setColor(on);
+ }
+ else{
+ g.setColor(Color.white);
+ }
+ g.fillOval(10,10,80,80);
+ }
+}
+
+public class TrafficLight extends JFrame implements ActionListener{
+ JRadioButton buttonRed,buttonYellow,buttonGreen;
+ Signal green=new Signal(Color.green);
+ Signal yellow=new Signal(Color.yellow);
+ Signal red=new Signal(Color.red);
+
+ public TrafficLight(){
+ setLayout(new FlowLayout());
+ buttonRed=new JRadioButton("Red");
+ buttonYellow=new JRadioButton("Yellow");
+ buttonGreen=new JRadioButton("Green");
+ buttonRed.addActionListener(this);
+ buttonYellow.addActionListener(this);
+ buttonGreen.addActionListener(this);
+ JPanel trafficPanel=new JPanel(new GridLayout(3,1));
+ trafficPanel.add(red);
+ trafficPanel.add(yellow);
+ trafficPanel.add(green);
+ JPanel lightPanel=new JPanel(new FlowLayout());
+ lightPanel.add(buttonRed);
+ lightPanel.add(buttonYellow);
+ lightPanel.add(buttonGreen);
+ add(trafficPanel);
+ add(lightPanel);
+ pack();
+ setVisible(true);
+ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ }
+
+ public static void main(String args[]){
+ new TrafficLight();
+ }
+
+ public void actionPerformed(ActionEvent e){
+ if(e.getSource()==buttonRed){
+ green.turnOn(false);
+ yellow.turnOn(false);
+ red.turnOn(true);
+ buttonYellow.setSelected(false);
+ buttonGreen.setSelected(false);
+ }
+ else if(e.getSource()==buttonYellow){
+ green.turnOn(false);
+ yellow.turnOn(true);
+ red.turnOn(false);
+ buttonRed.setSelected(false);
+ buttonGreen.setSelected(false);
+ }
+ else if(e.getSource()==buttonGreen){
+ green.turnOn(true);
+ yellow.turnOn(false);
+ red.turnOn(false);
+ buttonYellow.setSelected(false);
+ buttonRed.setSelected(false);
+ }
+ }
+}
diff --git a/AWT/UIElements/MyButton.java b/AWT/UIElements/MyButton.java
new file mode 100755
index 0000000..669005a
--- /dev/null
+++ b/AWT/UIElements/MyButton.java
@@ -0,0 +1,33 @@
+import java.awt.*;
+
+class HomeFrame extends Frame{
+ HomeFrame(String title) {
+ setTitle(title);
+ setSize(420, 420);
+ }
+}
+
+public class MyButton {
+ public static void main(String[] args) {
+ Frame frame = new HomeFrame("MyButton.java");
+ Image icon = Toolkit.getDefaultToolkit().getImage("../icon.png");
+ frame.setIconImage(icon);
+ Panel panel = new Panel();
+ frame.add(panel);
+
+ Button button1 = new Button(); // Constructor 1
+ button1.setLabel("Button 1"); // Method 1
+ panel.add(button1);
+
+ Button button2 = new Button("Button 2"); // Constructor 2
+ panel.add(button2);
+
+ frame.setVisible(true);
+
+ System.out.println("Label Text");
+ System.out.println(button1.getLabel()); // Method 2
+ System.out.println(button2.getLabel()); // Method 2
+ }
+}
+
+// ActionEvent and MouseEvent
\ No newline at end of file
diff --git a/AWT/UIElements/MyCheckbox.java b/AWT/UIElements/MyCheckbox.java
new file mode 100755
index 0000000..633edb1
--- /dev/null
+++ b/AWT/UIElements/MyCheckbox.java
@@ -0,0 +1,39 @@
+import java.awt.*;
+
+class HomeFrame extends Frame{
+ HomeFrame(String title) {
+ setTitle(title);
+ setSize(420, 420);
+ }
+}
+
+public class MyCheckbox {
+ public static void main(String[] args) {
+ Frame frame = new HomeFrame("MyCheckbox.java");
+ Image icon = Toolkit.getDefaultToolkit().getImage("../icon.png");
+ frame.setIconImage(icon);
+ Panel panel = new Panel();
+ frame.add(panel);
+
+ Checkbox checkbox1 = new Checkbox(); // Constructor 1
+ checkbox1.setLabel("Checkbox 1"); // Method 1
+ checkbox1.setState(false); // Method 2
+ panel.add(checkbox1);
+
+ Checkbox checkbox2 = new Checkbox("Checkbox 2"); // Constructor 2
+ checkbox2.setState(true); // Method 2
+ panel.add(checkbox2);
+
+ Checkbox checkbox3 = new Checkbox("Checkbox 3", false); // Constructor 3
+ panel.add(checkbox3);
+
+ frame.setVisible(true);
+
+ System.out.println("Label\t\tState");
+ System.out.println(checkbox1.getLabel() + "\t" + checkbox1.getState()); // Method 4 and 5
+ System.out.println(checkbox2.getLabel() + "\t" + checkbox2.getState()); // Method 4 and 5
+ System.out.println(checkbox3.getLabel() + "\t" + checkbox3.getState()); // Method 4 and 5
+ }
+}
+
+// ItemEvent
\ No newline at end of file
diff --git a/AWT/UIElements/MyChoice.java b/AWT/UIElements/MyChoice.java
new file mode 100755
index 0000000..9b3d73a
--- /dev/null
+++ b/AWT/UIElements/MyChoice.java
@@ -0,0 +1,41 @@
+import java.awt.*;
+
+class HomeFrame extends Frame{
+ HomeFrame(String title) {
+ setTitle(title);
+ setSize(420, 420);
+ }
+}
+// Choice == Dropdown
+public class MyChoice {
+ public static void main(String[] args) {
+ Frame frame = new HomeFrame("MyChoice.java");
+ Image icon = Toolkit.getDefaultToolkit().getImage("../icon.png");
+ frame.setIconImage(icon);
+ Panel panel = new Panel();
+ frame.add(panel);
+
+ Choice c1 = new Choice(); // Constructor 1
+ c1.add("item 1"); // Method 1
+ c1.add("item 2"); // Method 1
+ c1.add("item 3"); // Method 1
+ c1.add("item 4"); // Method 1
+ c1.add("item 5"); // Method 1
+ System.out.println("c1.getItem(int index) = " + c1.getItem(0)); // Method 2
+ System.out.println("c1.getItemCount() = " + c1.getItemCount()); // Method 3
+ c1.select(1); // Method 11
+ c1.select("item 4"); // Method 12
+ System.out.println("c1.getSelectedIndex() = " + c1.getSelectedIndex()); // Method 4
+ System.out.println("c1.getSelectedItem() = " + c1.getSelectedItem()); // Method 5
+ System.out.println("c1.getSelectedObjects() = " + c1.getSelectedObjects()); // Method 6
+ c1.insert("item 6", 5); // Method 7
+ c1.remove(4); // Method 8
+ c1.remove("item 3"); // Method 9
+ c1.removeAll(); // Method 10
+ panel.add(c1);
+
+ frame.setVisible(true);
+ }
+}
+
+// ItemEvent
\ No newline at end of file
diff --git a/AWT/UIElements/MyLabel.java b/AWT/UIElements/MyLabel.java
new file mode 100755
index 0000000..e8658c1
--- /dev/null
+++ b/AWT/UIElements/MyLabel.java
@@ -0,0 +1,39 @@
+import java.awt.*;
+
+class HomeFrame extends Frame{
+ HomeFrame(String title) {
+ setTitle(title);
+ setSize(420, 420);
+ }
+}
+
+public class MyLabel {
+ public static void main(String[] args) {
+ Frame frame = new HomeFrame("MyLabel.java");
+ Image icon = Toolkit.getDefaultToolkit().getImage("../icon.png");
+ frame.setIconImage(icon);
+ Panel panel = new Panel();
+ frame.add(panel);
+
+ Label label1 = new Label(); // Constructor 1
+ label1.setText("Label 1"); // Method 1
+ // label1.setAlignment(Label.LEFT); // Method 2
+ panel.add(label1);
+
+ Label label2 = new Label("Label 2"); // Constructor 2
+ label2.setAlignment(Label.CENTER); // Method 2
+ panel.add(label2);
+
+ Label label3 = new Label("Label 3", Label.RIGHT); // Constructor 3
+ panel.add(label3);
+
+ frame.setVisible(true);
+
+ System.out.println("Text\t\tAlignment");
+ System.out.println(label1.getText() + "\t\t" + label1.getAlignment()); // Method 3 and 4
+ System.out.println(label2.getText() + "\t\t" + label2.getAlignment()); // Method 3 and 4
+ System.out.println(label3.getText() + "\t\t" + label3.getAlignment()); // Method 3 and 4
+ }
+}
+
+// No Events
\ No newline at end of file
diff --git a/AWT/UIElements/MyList.java b/AWT/UIElements/MyList.java
new file mode 100755
index 0000000..dd464eb
--- /dev/null
+++ b/AWT/UIElements/MyList.java
@@ -0,0 +1,87 @@
+import java.awt.*;
+
+class HomeFrame extends Frame{
+ HomeFrame(String title) {
+ setTitle(title);
+ setSize(420, 420);
+ }
+}
+
+public class MyList {
+ public static void main(String[] args) {
+ Frame frame = new HomeFrame("MyList.java");
+ Image icon = Toolkit.getDefaultToolkit().getImage("../icon.png");
+ frame.setIconImage(icon);
+ Panel panel = new Panel();
+ frame.add(panel);
+
+ List l1 = new List(); // Constructor 1
+ l1.add("Item 1"); // Method 1
+ l1.add("Item 2"); // Method 1
+ l1.add("Item 3"); // Method 1
+ l1.add("Item 4"); // Method 1
+ l1.add("Item 5"); // Method 1
+ l1.add("Item 6", 7/*index*/); // Method 2
+ l1.remove(5/*index*/); // Method 4
+ l1.remove("Item 3"); // Method 5
+ System.out.println("l1.getItemCount() = " + l1.getItemCount()); // Method 3
+ l1.deselect(0); // Method 6
+ System.out.println("\nl1.getItem(int index) = " + l1.getItem(0)); // Method 7
+ System.out.println("\nString array of l1.items =");
+ String items[] = l1.getItems(); // Method 8
+ for (int i = 0; i < l1.getItemCount(); i++) { // Method 3
+ System.out.println(items[i]);
+ }
+ System.out.println("\nl1.getSelectedIndex(int index) = " + l1.getSelectedIndex()); // Method 10 // Only for singleSelect
+ int l1Selected[] = l1.getSelectedIndexes(); // Method 11 // For both singleSelect and multiSelect
+ System.out.println("l1.getSelectedIndexes = " + l1Selected.length);
+ // for (int i = 0; i < l1Selected.length; i++) {
+ // System.out.println("l1.getSelectedIndexes = " + l1Selected[i]);
+ // if (l1Selected.length == -1) {
+ // break;
+ // }
+ // }
+ System.out.println("l1.getSelectedItem = " + l1.getSelectedItem()); // Method 12
+ String selectedItems[] = l1.getSelectedItems(); // Method 13
+ System.out.println("l1.getSelectedItems = " + selectedItems.length);
+ System.out.println("l1.isMultipleMode() = " + l1.isMultipleMode()); // Method 14
+ l1.select(0); // Method 19
+ System.out.println("l1.isIndexSelected(int index) = " + l1.isIndexSelected(0)); // Method 15
+ panel.add(l1);
+
+ int rows = 6;
+ List l2 = new List(rows); // Constructor 2 // specifies number of items on display
+ l2.add("Item 1"); // Method 1
+ l2.add("Item 2"); // Method 1
+ l2.add("Item 3"); // Method 1
+ l2.add("Item 4"); // Method 1
+ l2.add("Item 5"); // Method 1
+ l2.add("Item 6"); // Method 1
+ l2.add("Item 7"); // Method 1 // no error
+ if(l2.getRows() == rows) { // Method 9
+ System.out.println("\nNumber of visible l2.rows = " + l2.getRows()); // Method 9
+ }
+ l2.makeVisible(6); // Method 16
+ l2.replaceItem("New Item 7", 6); // Method 18
+ l2.remove(5); // Method 21
+ l2.remove("Item 4"); // Method 22
+ panel.add(l2);
+
+ List l3 = new List(5, true); // Constructor 3 // specifies number of items on display and sets Multiple Select
+ l3.add("Item 1"); // Method 1
+ l3.add("Item 2"); // Method 1
+ l3.add("Item 3"); // Method 1
+ l3.add("Item 4"); // Method 1
+ l3.add("Item 5"); // Method 1
+ int l3Selected[] = l3.getSelectedIndexes(); // Method 11 // For both singleSelect and multiSelect
+ System.out.println("\nl3.getSelectedIndexes = " + l3Selected.length);
+ l3.setMultipleMode(false); // Method 20
+ System.out.println("l3.isMultipleMode() = " + l3.isMultipleMode()); // Method 14
+ l3.removeAll(); // Method 17
+ panel.add(l3);
+
+ frame.setVisible(true);
+ }
+}
+
+// ActionEvent and ItemEvent
\ No newline at end of file
diff --git a/AWT/UIElements/MyRadio.java b/AWT/UIElements/MyRadio.java
new file mode 100755
index 0000000..aa3d383
--- /dev/null
+++ b/AWT/UIElements/MyRadio.java
@@ -0,0 +1,41 @@
+import java.awt.*;
+
+class HomeFrame extends Frame{
+ HomeFrame(String title) {
+ setTitle(title);
+ setSize(420, 420);
+ }
+}
+
+public class MyRadio {
+ public static void main(String[] args) {
+ Frame frame = new HomeFrame("MyRadio.java");
+ Image icon = Toolkit.getDefaultToolkit().getImage("../icon.png");
+ frame.setIconImage(icon);
+ Panel panel = new Panel();
+ frame.add(panel);
+
+ CheckboxGroup cbg = new CheckboxGroup();
+
+ Checkbox checkbox1 = new Checkbox();
+ checkbox1.setLabel("Radio Button 1"); // Method 1
+ checkbox1.setState(true); // Method 2
+ checkbox1.setCheckboxGroup(cbg); // Method 3
+ panel.add(checkbox1);
+
+ Checkbox checkbox2 = new Checkbox("Radio Button 2", false, cbg); // Constructor 4
+ // checkbox2.setState(true);
+ panel.add(checkbox2);
+
+ frame.setVisible(true);
+
+ System.out.println("Label\t\tState\t\tCheckbox Group");
+ System.out.println(checkbox1.getLabel() + "\t" + checkbox1.getState() + "\t" + checkbox1.getCheckboxGroup()); // Method 4, 5 and 6
+ System.out.println(checkbox2.getLabel() + "\t" + checkbox2.getState() + "\t" + checkbox2.getCheckboxGroup()); // Method 4, 5 and 6
+
+ // Checkbox chbx = getSelectedCheckbox();
+ // System.out.println(chbx.getLabel());
+ }
+}
+
+// ItemEvent
\ No newline at end of file
diff --git a/AWT/UIElements/MyScrollBar.java b/AWT/UIElements/MyScrollBar.java
new file mode 100755
index 0000000..0c7a7dc
--- /dev/null
+++ b/AWT/UIElements/MyScrollBar.java
@@ -0,0 +1,46 @@
+import java.awt.*;
+
+class HomeFrame extends Frame{
+ HomeFrame(String title) {
+ setTitle(title);
+ setSize(420, 420);
+ }
+}
+
+public class MyScrollBar {
+ public static void main(String[] args) {
+ Frame frame = new HomeFrame("MyChoice.java");
+ Image icon = Toolkit.getDefaultToolkit().getImage("../icon.png");
+ frame.setIconImage(icon);
+ Panel panel = new Panel();
+ frame.add(panel);
+
+ Scrollbar s1 = new Scrollbar(); // Constructor 1
+ s1.setValues(12, 1, 0, 255); // Method 16
+ panel.add(s1);
+ Scrollbar s2 = new Scrollbar(Scrollbar.HORIZONTAL); // Constructor 2
+ panel.add(s2);
+ Scrollbar s3 = new Scrollbar(Scrollbar.HORIZONTAL, 0, 1, 0, 255); // Constructor 3
+ s3.setBlockIncrement(3); // Method 9
+ System.out.println("s3.getBlockIncrement() = " + s3.getBlockIncrement()); // Method 1
+ s3.setMaximum(420); // Method 10
+ System.out.println("s3.getMaximum() = " + s3.getMaximum()); // Method 2
+ s3.setMinimum(69); // Method 11
+ System.out.println("s3.getMinimum() = " + s3.getMinimum()); // Method 3
+ s3.setOrientation(Scrollbar.VERTICAL); // Method 12
+ System.out.println("s3.getOrientation() = " + s3.getOrientation()); // Method 4
+ s3.setUnitIncrement(5); // Method 13
+ System.out.println("s3.getUnitIncrement() = " + s3.getUnitIncrement()); // Method 5
+ s3.setValue(169); // Method 14
+ System.out.println("s3.getValue() = " + s3.getValue()); // Method 6
+ s3.setValueIsAdjusting(true); // Method 15
+ System.out.println("s3.getValueIsAdjusting() = " + s3.getValueIsAdjusting()); // Method 7
+ s3.setVisibleAmount(25); // Method 17
+ System.out.println("s3.getVisibleAmount() = " + s3.getVisibleAmount()); // Method 8
+ panel.add(s3);
+
+ frame.setVisible(true);
+ }
+}
+
+// AdjustmentEvent
\ No newline at end of file
diff --git a/AWT/UIElements/MyTextArea.java b/AWT/UIElements/MyTextArea.java
new file mode 100755
index 0000000..b1f54b1
--- /dev/null
+++ b/AWT/UIElements/MyTextArea.java
@@ -0,0 +1,47 @@
+import java.awt.*;
+
+class HomeFrame extends Frame{
+ HomeFrame(String title) {
+ setTitle(title);
+ setSize(420, 420);
+ }
+}
+
+public class MyTextArea {
+ public static void main(String[] args) {
+ Frame frame = new HomeFrame("MyTextArea.java");
+ Image icon = Toolkit.getDefaultToolkit().getImage("../icon.png");
+ frame.setIconImage(icon);
+ Panel panel = new Panel();
+ frame.add(panel);
+
+ TextArea t1 = new TextArea(); // Constructor 1
+ panel.add(t1);
+ t1.setColumns(60); // Method 8
+ System.out.println("t1.getColumns() = " + t1.getColumns()); // Method 2
+ t1.setRows(10); // Method 9
+ System.out.println("t1.getRows() = " + t1.getRows()); // Method 4
+ Dimension d = t1.getMinimumSize(); // Method 3
+ System.out.println("d.width = " + d.width + "\td.height = " + d.height);
+
+ TextArea t2 = new TextArea(10/*Rows*/, 60/*Columns*/); // Constructor 2 // Default (10, 60)
+ panel.add(t2);
+
+ TextArea t3 = new TextArea("Text Area 3"); // Constructor 3
+ t3.append("\tAppend Hello World"); // Method 1
+ t3.insert("\tInsert", 18); // Method 6
+ t3.replaceRange("Heyoo", 26, 31); // Method 7
+ panel.add(t3);
+
+ TextArea t4 = new TextArea("Text Area 4", 10, 60); // Constructor 4
+ panel.add(t4);
+
+ TextArea t5 = new TextArea("Text Area 5", 10, 60, 4); // Constructor 5
+ System.out.println(t5.getScrollbarVisibility()); // Method 5
+ panel.add(t5);
+
+ frame.setVisible(true);
+ }
+}
+
+// KeyEvent and TextEvent
\ No newline at end of file
diff --git a/AWT/UIElements/MyTextField.java b/AWT/UIElements/MyTextField.java
new file mode 100755
index 0000000..f1b6cea
--- /dev/null
+++ b/AWT/UIElements/MyTextField.java
@@ -0,0 +1,38 @@
+import java.awt.*;
+
+class HomeFrame extends Frame{
+ HomeFrame(String title) {
+ setTitle(title);
+ setSize(420, 420);
+ }
+}
+
+public class MyTextField {
+ public static void main(String[] args) {
+ Frame frame = new HomeFrame("MyTextField.java");
+ Image icon = Toolkit.getDefaultToolkit().getImage("../icon.png");
+ frame.setIconImage(icon);
+ Panel panel = new Panel();
+ frame.add(panel);
+
+ TextField t1 = new TextField(); // Constructor 1
+ panel.add(t1);
+ char c = '*';
+ t1.setEchoChar(c); // Method 5
+ System.out.println("t1.echoCharIsSet() = " + t1.echoCharIsSet()); // Method 1
+ System.out.println("t1.getEchoChar() = " + t1.getEchoChar()); // Method 3
+ t1.setColumns(10); // Method 4
+ t1.setText("Text Field 1"); // Method 6
+
+ TextField t2 = new TextField(20); // Constructor 2
+ panel.add(t2);
+ System.out.println("t2.getColumns() = " + t2.getColumns()); // Method 2
+
+ TextField t3 = new TextField("Text Field 3"); // Constructor 3
+ panel.add(t3);
+
+ frame.setVisible(true);
+ }
+}
+
+// KeyEvent and ActionEvent
\ No newline at end of file
diff --git a/AWT/hello.java b/AWT/hello.java
new file mode 100644
index 0000000..0a55a80
--- /dev/null
+++ b/AWT/hello.java
@@ -0,0 +1,8 @@
+import java.util.Scanner;
+class hello
+{
+ public static void main(String[] args)
+ {
+ System.out.println("Hello");
+ }
+}
diff --git a/AWT/icon.png b/AWT/icon.png
new file mode 100755
index 0000000..c6f7169
Binary files /dev/null and b/AWT/icon.png differ
diff --git a/Anagram.java b/Anagram.java
new file mode 100644
index 0000000..7ea74ce
--- /dev/null
+++ b/Anagram.java
@@ -0,0 +1,32 @@
+import java.io.*;
+import java.util.*;
+class Anagram{
+ public static void main(String args[]){
+ String str1,str2;
+ Scanner sc=new Scanner(System.in);
+ System.out.println("Enter the String 1");
+ str1=sc.nextLine();
+ System.out.println("Enter the String 2");
+ str2=sc.nextLine();
+ if(str1.length()!=str2.length()){
+ System.out.println("The Strings "+str1+" and"+str2+" is not a Anagram");
+ }
+ else{
+ str1=str1.toLowerCase();
+ str2=str2.toLowerCase();
+ char[]arr1=str1.toCharArray();
+ char []arr2=str2.toCharArray();
+ Arrays.sort(arr1);
+ Arrays.sort(arr2);
+ if(Arrays.equals(arr1,arr2)==true){
+ System.out.println("The Strings "+str1+" and"+str2+" is a Anagram");
+ }
+ else{
+ System.out.println("The Strings "+str1+" and"+sātr2+" is not a Anagram");
+ }
+ }
+ }
+}
+
+
+
\ No newline at end of file
diff --git a/Armstrong.java b/Armstrong.java
new file mode 100644
index 0000000..e45f127
--- /dev/null
+++ b/Armstrong.java
@@ -0,0 +1,46 @@
+import java.util.Scanner;
+import java.lang.Math;
+public class Armstrong
+{
+ static boolean isArmstrong(int n)
+ {
+ int temp, digits=0, last=0, sum=0;
+ temp=n;
+
+ while(temp>0)
+ {
+ temp = temp/10;
+ digits++;
+ }
+
+ temp = n;
+
+ while(temp>0)
+ {
+ last = temp % 10;
+ sum += (Math.pow(last, digits));
+ temp = temp/10;
+ }
+
+ if(n==sum)
+
+ return true;
+
+ else return false;
+}
+
+ public static void main(String args[])
+ {
+ int num;
+ Scanner sc= new Scanner(System.in);
+ System.out.print("Enter the max: ");
+
+ num=sc.nextInt();
+ System.out.println("Armstrong Number up to "+ num + " are: ");
+ sc.close();
+
+ for(int i=0; i<=num; i++)
+ if(isArmstrong(i))
+ System.out.print(i+ ", ");
+ }
+}
\ No newline at end of file
diff --git a/ArrayList.java b/ArrayList.java
index 57ae00b..d62cd2d 100644
--- a/ArrayList.java
+++ b/ArrayList.java
@@ -18,6 +18,10 @@ public static void main(String[] args) {
System.out.println(arr);
//acessing the element by index -->method get(i)
System.out.println(arr.get(2));
+ //To print the elements or ArrayList.(enhanced loop is used)
+ for(int element : arr){
+ System.out.println(element);
+ }
}
}
diff --git a/ArrayListIteration.java b/ArrayListIteration.java
new file mode 100644
index 0000000..6e14e50
--- /dev/null
+++ b/ArrayListIteration.java
@@ -0,0 +1,39 @@
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+public class ArrayListIteration {
+ public static void main(String[] args) {
+ List courses = Arrays.asList("C","C++","Java","Spring");
+
+ //Basic for loop
+ for(int i=0; i iterator = courses.iterator();iterator.hasNext();){
+ String course = (String)iterator.next();
+ System.out.println(course);
+ }
+
+ //iterator with while loop
+ Iterator iterate = courses.iterator();
+ while(iterate.hasNext()){
+ String course = (String)iterate.next();
+ System.out.println(course);
+ }
+
+ //Java 8 stream + lambda
+ System.out.println("Java 8 Lambda");
+ courses.stream().forEach(course -> System.out.println(course));
+
+ // Java 8 forEach + lambda
+ courses.forEach(course -> System.out.println(course));
+ }
+}
diff --git a/ArrayListString.java b/ArrayListString.java
new file mode 100644
index 0000000..4ee78d3
--- /dev/null
+++ b/ArrayListString.java
@@ -0,0 +1,59 @@
+import java.util.ArrayList;
+
+public class ArrayListString {
+
+ public static void main(String[] args) {
+
+ // declaring and instantiate a String List
+ ArrayList listaString = new ArrayList();
+
+ // adding info at list
+ listaString.add("Elemento 1");
+ listaString.add("Elemento 2");
+ listaString.add("Elemento 3");
+
+ // show list
+ System.out.println(listaString.get(0));
+ System.out.println(listaString.get(1));
+ System.out.println(listaString.get(2));
+
+ // add an element in specific position
+ listaString.add(1, "Elemento 1.5");
+
+ // show list itens
+ for (String obj : listaString) {
+ System.out.println(obj);
+ }
+
+ // get list size
+ System.out.println("O tamanho da lista é:" + listaString.size());
+
+ // find an list value
+ if (listaString.contains("Elemento 1")) {
+ System.out.println("Elemento encontrado");
+ } else {
+ System.out.println("Elemento não encontrado ");
+ }
+
+ // print index from element
+ int indice = listaString.indexOf("Elemento 1");
+ System.out.println("Indice: " + indice);
+
+ // adding a new element
+ listaString.add("Elemento 4");
+
+ // get list size
+ System.out.println("O tamanho da lista é:" + listaString.size());
+
+ // remove an list element
+ listaString.remove("Elemento 1.5");
+ for (String obj : listaString) {
+ System.out.println(obj);
+ }
+
+ // get list size
+ System.out.println("O tamanho da lista é:" + listaString.size());
+
+ }
+
+}
diff --git a/BST.java b/BST.java
new file mode 100644
index 0000000..7266606
--- /dev/null
+++ b/BST.java
@@ -0,0 +1,99 @@
+// Java program to demonstrate
+// insert operation in binary
+// search tree
+class BinarySearchTree {
+
+ /* Class containing left
+ and right child of current node
+ * and key value*/
+ class Node
+ {
+ int key;
+ Node left, right;
+
+ public Node(int item)
+ {
+ key = item;
+ left = right = null;
+ }
+ }
+
+ // Root of BST
+ Node root;
+
+ // Constructor
+ BinarySearchTree()
+ {
+ root = null;
+ }
+
+ // This method mainly calls insertRec()
+ void insert(int key)
+ {
+ root = insertRec(root, key);
+ }
+
+ /* A recursive function to
+ insert a new key in BST */
+ Node insertRec(Node root, int key)
+ {
+
+ /* If the tree is empty,
+ return a new node */
+ if (root == null)
+ {
+ root = new Node(key);
+ return root;
+ }
+
+ /* Otherwise, recur down the tree */
+ if (key < root.key)
+ root.left = insertRec(root.left, key);
+ else if (key > root.key)
+ root.right = insertRec(root.right, key);
+
+ /* return the (unchanged) node pointer */
+ return root;
+ }
+
+ // This method mainly calls InorderRec()
+ void inorder()
+ {
+ inorderRec(root);
+ }
+
+ // A utility function to
+ // do inorder traversal of BST
+ void inorderRec(Node root)
+ {
+ if (root != null) {
+ inorderRec(root.left);
+ System.out.println(root.key);
+ inorderRec(root.right);
+ }
+ }
+
+ // Driver Code
+ public static void main(String[] args)
+ {
+ BinarySearchTree tree = new BinarySearchTree();
+
+ /* Let us create following BST
+ 50
+ / \
+ 30 70
+ / \ / \
+ 20 40 60 80 */
+ tree.insert(50);
+ tree.insert(30);
+ tree.insert(20);
+ tree.insert(40);
+ tree.insert(70);
+ tree.insert(60);
+ tree.insert(80);
+
+ // print inorder traversal of the BST
+ tree.inorder();
+ }
+}
+
diff --git a/BasicRSA.java b/BasicRSA.java
new file mode 100644
index 0000000..07a3936
--- /dev/null
+++ b/BasicRSA.java
@@ -0,0 +1,72 @@
+
+import java.math.BigInteger;
+import java.util.Scanner;
+
+public class BasicRSA{
+
+ static int gcd(int a, int b)
+ { /*Returns Greatest common divisor of 2 numbers
+ *implementing Euclidean ALgorithm */
+
+ if (a == 0) return b;
+ else return gcd(b % a, a);
+ }
+
+ static int modInv(int a, int b)
+ { /*Returns modular inverse of a mod b
+ *implementing Extended Euclidean ALgorithm*/
+ return modInv(a,b,b,0,1);
+ }
+
+ static int modInv(int a,int b,int c,int x,int y)
+ { //over-loading
+
+ if(b%a==0) return y;
+ else return modInv(b%a,a,c,y,c+(x-(b/a)*y)%c );
+ }
+
+ public static void main(String args[]){
+
+ Scanner sc= new Scanner(System.in);
+ System.out.println("You are required to enter 2 prime numbers followed by the message you want to encrypt");
+
+ System.out.println("Enter first prime :");
+ int p= sc.nextInt();
+
+ System.out.println("Enter Second prime:");
+ int q=sc.nextInt();
+
+ System.out.println("Enter a num to encrypt:");
+ int m=sc.nextInt();
+ //Plaintext: message to be encrypted
+
+ sc.close();
+
+ int n=p*q;
+ int z=(p-1)*(q-1)/gcd(p-1,q-1);
+ int e,d=0; // e is for public key exponent, d is for private key exponent
+
+ for (e = 2; e < z; e++) {
+ if (gcd(e, z) == 1) {
+ break;
+ }
+ }
+
+ d=modInv(e,z);
+
+ BigInteger M= BigInteger.valueOf(m);
+ BigInteger E= BigInteger.valueOf(e);
+ BigInteger N= BigInteger.valueOf(n);
+ BigInteger D= BigInteger.valueOf(d);
+ BigInteger C= M.modPow(E,N);
+ BigInteger M2= C.modPow(D,N);
+
+
+
+ System.out.println("Public Key Pair : " + e + " " + n );
+ System.out.println("Private Key Pair : " + d + " " + n );
+ System.out.println("Encrypted num : "+ C);
+ System.out.println("Decrypted num : "+ M2);
+ System.out.println("This is deciphered using Private key");
+ }
+}
diff --git a/BattleshipsInABoard.java b/BattleshipsInABoard.java
new file mode 100644
index 0000000..5d79879
--- /dev/null
+++ b/BattleshipsInABoard.java
@@ -0,0 +1,60 @@
+// https://leetcode.com/problems/battleships-in-a-board/
+
+//Solution 1
+class Solution {
+ public int countBattleships(char[][] board) {
+ int numBattleships = 0;
+ for(int i=0; i0 && board[i-1][j] == 'X') {
+ continue;
+ }
+
+ if(j>0 && board[i][j-1] == 'X') {
+ continue;
+ }
+
+ numBattleships++;
+ }
+ }
+
+ return numBattleships;
+ }
+
+}
+
+
+
+// Solution 2
+
+class Solution {
+ public int countBattleships(char[][] board) {
+ int numBattleships = 0;
+ for(int i=0; i= board.length || j<0 || j>= board[i].length || board[i][j] != 'X') {
+ return;
+ }
+
+ board[i][j] = '.';
+ sink(board, i+1, j);
+ sink(board, i-1, j);
+ sink(board, i, j+1);
+ sink(board, i, j-1);
+ }
+}
diff --git a/BinarySearch.java b/BinarySearch.java
new file mode 100644
index 0000000..040e4aa
--- /dev/null
+++ b/BinarySearch.java
@@ -0,0 +1,39 @@
+class BinSearch{
+ public void BinarySearach(int[] arr,int left,int right,int val){
+
+ while(left <= right){
+
+ int mid = (left + right)/2;
+
+ if(val == arr[mid]){
+ System.out.println("Element found at index : " + mid);
+ break;
+ }
+
+ else if(arr[mid] < val){
+ left = val + 1;
+ }
+
+ else{
+ right = mid-1;
+ }
+
+ if(left > right){
+ System.out.println("Element Not Found");
+ }
+
+ }
+
+ }
+}
+
+public class BinarySearch{
+ public static void main(String[] args) {
+ BinSearch bs = new BinSearch();
+
+ int[] arr = {1,2,3,4,5};
+
+ bs.BinarySearach(arr, 0, arr.length-1, 3);
+ bs.BinarySearach(arr, 0, arr.length-1, 7);
+ }
+}
\ No newline at end of file
diff --git a/BinaryTree.java b/BinaryTree.java
new file mode 100644
index 0000000..c9de616
--- /dev/null
+++ b/BinaryTree.java
@@ -0,0 +1,103 @@
+// Java program to print top
+// view of binary tree
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Queue;
+import java.util.TreeMap;
+
+// class to create a node
+class Node {
+ int data;
+ Node left, right;
+
+ public Node(int data)
+ {
+ this.data = data;
+ left = right = null;
+ }
+}
+
+// class of binary tree
+class BinaryTree {
+ Node root;
+
+ public BinaryTree() { root = null; }
+
+ // function should print the topView of
+ // the binary tree
+ private void TopView(Node root)
+ {
+ class QueueObj {
+ Node node;
+ int hd;
+
+ QueueObj(Node node, int hd)
+ {
+ this.node = node;
+ this.hd = hd;
+ }
+ }
+ Queue q = new LinkedList();
+ Map topViewMap
+ = new TreeMap();
+
+ if (root == null) {
+ return;
+ }
+ else {
+ q.add(new QueueObj(root, 0));
+ }
+
+ System.out.println(
+ "The top view of the tree is : ");
+
+ // count function returns 1 if the container
+ // contains an element whose key is equivalent
+ // to hd, or returns zero otherwise.
+ while (!q.isEmpty()) {
+ QueueObj tmpNode = q.poll();
+ if (!topViewMap.containsKey(tmpNode.hd)) {
+ topViewMap.put(tmpNode.hd, tmpNode.node);
+ }
+
+ if (tmpNode.node.left != null) {
+ q.add(new QueueObj(tmpNode.node.left,
+ tmpNode.hd - 1));
+ }
+ if (tmpNode.node.right != null) {
+ q.add(new QueueObj(tmpNode.node.right,
+ tmpNode.hd + 1));
+ }
+ }
+ for (Entry entry :
+ topViewMap.entrySet()) {
+ System.out.print(entry.getValue().data);
+ }
+ }
+
+ // Driver Program to test above functions
+ public static void main(String[] args)
+ {
+ /* Create following Binary Tree
+ 1
+ / \
+ 2 3
+ \
+ 4
+ \
+ 5
+ \
+ 6*/
+ BinaryTree tree = new BinaryTree();
+ tree.root = new Node(1);
+ tree.root.left = new Node(2);
+ tree.root.right = new Node(3);
+ tree.root.left.right = new Node(4);
+ tree.root.left.right.right = new Node(5);
+ tree.root.left.right.right.right = new Node(6);
+ System.out.println(
+ "Following are nodes in top view of Binary Tree");
+ tree.TopView(tree.root);
+ }
+}
diff --git a/BogoSort.java b/BogoSort.java
new file mode 100644
index 0000000..24eab33
--- /dev/null
+++ b/BogoSort.java
@@ -0,0 +1,50 @@
+public class BogoSort
+{
+ public static void main(String[] args)
+ {
+ int[] arr={4,5,6,0,7,8,9,1,2,3};
+
+ BogoSort now=new BogoSort();
+ System.out.print("Unsorted is ");
+ now.display1D(arr);
+
+ now.bogo(arr);
+
+ System.out.print("Sorted is ");
+ now.display1D(arr);
+ }
+ void bogo(int[] arr)
+ {
+ int shuffle=1;
+ for(;!isSorted(arr);shuffle++)
+ shuffle(arr);
+ //Boast
+ System.out.println("This took "+shuffle+" shuffles");
+ }
+ void shuffle(int[] arr)
+ {
+ int i=arr.length-1;
+ while(i>0)
+ swap(arr,i--,(int)(Math.random()*i));
+ }
+ void swap(int[] arr,int i,int j)
+ {
+ int temp=arr[i];
+ arr[i]=arr[j];
+ arr[j]=temp;
+ }
+ boolean isSorted(int[] arr)
+ {
+
+ for(int i=1;i map = new TreeMap<>();
+
+ // Queue to store tree nodes in level order traversal
+ Queue queue = new LinkedList();
+
+ // Assign initialized horizontal distance value to root
+ // node and add it to the queue.
+ root.hd = hd;
+ queue.add(root);
+
+ // Loop until the queue is empty (standard level order loop)
+ while (!queue.isEmpty())
+ {
+ Node temp = queue.remove();
+
+ // Extract the horizontal distance value from the
+ // dequeued tree node.
+ hd = temp.hd;
+
+ // Put the dequeued tree node to TreeMap having key
+ // as horizontal distance. Every time we find a node
+ // having same horizontal distance we need to replace
+ // the data in the map.
+ map.put(hd, temp.data);
+
+ // If the dequeued node has a left child add it to the
+ // queue with a horizontal distance hd-1.
+ if (temp.left != null)
+ {
+ temp.left.hd = hd-1;
+ queue.add(temp.left);
+ }
+ // If the dequeued node has a right child add it to the
+ // queue with a horizontal distance hd+1.
+ if (temp.right != null)
+ {
+ temp.right.hd = hd+1;
+ queue.add(temp.right);
+ }
+ }
+
+ // Extract the entries of map into a set to traverse
+ // an iterator over that.
+ Set> set = map.entrySet();
+
+ // Make an iterator
+ Iterator> iterator = set.iterator();
+
+ // Traverse the map elements using the iterator.
+ while (iterator.hasNext())
+ {
+ Map.Entry me = iterator.next();
+ System.out.print(me.getValue()+" ");
+ }
+ }
+}
+
+// Main driver class
+public class BottomView
+{
+ public static void main(String[] args)
+ {
+ Node root = new Node(20);
+ root.left = new Node(8);
+ root.right = new Node(22);
+ root.left.left = new Node(5);
+ root.left.right = new Node(3);
+ root.right.left = new Node(4);
+ root.right.right = new Node(25);
+ root.left.right.left = new Node(10);
+ root.left.right.right = new Node(14);
+ Tree tree = new Tree(root);
+ System.out.println("Bottom view of the given binary tree:");
+ tree.bottomView();
+ }
+}
diff --git a/BreakDigit.java b/BreakDigit.java
new file mode 100644
index 0000000..e9adf22
--- /dev/null
+++ b/BreakDigit.java
@@ -0,0 +1,37 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.mycompany.worksheet1;
+
+import java.util.Scanner;
+
+/**
+ *
+ * @author Shanmuga Priya M
+ */
+public class breakdigit {
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String[] args) {
+ int n,r,i,j;
+ i=0;
+ int a[]=new int[10];
+ Scanner obj= new Scanner(System.in);
+ n=obj.nextInt();
+ while(n>0){
+ r=n%10;
+ a[i]=r;
+ n=n/10;
+ i++;
+ }
+ for(j=i-1;j>=0 ;j--){
+ System.out.println(a[j]);
+ }
+
+ }
+
+}
diff --git a/BubbleSort.java b/BubbleSort.java
index 077561b..dbb3ee1 100644
--- a/BubbleSort.java
+++ b/BubbleSort.java
@@ -1,30 +1,27 @@
+ // This is a buuble sort program made with JAVA
+
import java.lang.*;
-public class BubbleSort{
- public static void main(String arg[])
- {
+
+public class BubbleSort {
+ public static void main(String arg[]) {
int a[]={30,60,35,20,45,32,50};
System.out.println("Array Before Sorting");
- for(int i=0;ia[j])
- {
+ for(int i=0;ia[j]) {
t = a[j-1];
a[j-1] = a[j];
a[j]= t;
@@ -32,4 +29,4 @@ static void bubbleSort(int[] a){
}
}
}
-}
\ No newline at end of file
+}
diff --git a/BucketSort.java b/BucketSort.java
new file mode 100644
index 0000000..86fae1a
--- /dev/null
+++ b/BucketSort.java
@@ -0,0 +1,52 @@
+
+import java.util.*;
+import java.util.Collections;
+
+class BucketSort {
+
+ static void bucketSort(float arr[], int n)
+ {
+ if (n <= 0)
+ return;
+
+ Vector[] buckets = new Vector[n];
+
+ for (int i = 0; i < n; i++) {
+ buckets[i] = new Vector();
+ }
+
+ // Put array elements in different buckets
+ for (int i = 0; i < n; i++) {
+ float idx = arr[i] * n;
+ buckets[(int)idx].add(arr[i]);
+ }
+
+ // Sort individual buckets
+ for (int i = 0; i < n; i++) {
+ Collections.sort(buckets[i]);
+ }
+
+ // Concatenate all buckets
+ int index = 0;
+ for (int i = 0; i < n; i++) {
+ for (int j = 0; j < buckets[i].size(); j++) {
+ arr[index++] = buckets[i].get(j);
+ }
+ }
+ }
+
+ public static void main(String args[])
+ {
+ float arr[] = { (float)0.89, (float)0.55,
+ (float)0.65, (float)0.124,
+ (float)0.66, (float)0.34 };
+
+ int n = arr.length;
+ bucketSort(arr, n);
+
+ System.out.println("Sorted array is ");
+ for (float el : arr) {
+ System.out.print(el + " ");
+ }
+ }
+}
diff --git a/Buzz.java b/Buzz.java
new file mode 100644
index 0000000..be2710e
--- /dev/null
+++ b/Buzz.java
@@ -0,0 +1,19 @@
+import java.util.*;
+public class Buzz
+{
+ public static void main(String args[])
+ {
+ int n;
+ Scanner scan=new Scanner(System.in);
+ System.out.print("Enter a number: ");
+ n=scan.nextInt();
+ if(n%7==0||n%10==7)
+ {
+ System.out.println(n+" is a Buzz number");
+ }
+ else
+ {
+ System.out.println(n+" is not a Buzz number");
+ }
+ }
+}
diff --git a/Calculator.java b/Calculator.java
new file mode 100644
index 0000000..e347fc6
--- /dev/null
+++ b/Calculator.java
@@ -0,0 +1,73 @@
+import java.util.Scanner;
+
+public class Calculator {
+
+ public static void main(String[] args) {
+
+ Scanner input = new Scanner(System.in);
+
+ int ans = 0;
+
+ while (true) {
+
+ System.out.print("Enter a operator [+ - * / %] = ");
+
+ char op = input.next().trim().charAt(0);
+
+ if (op == '+' || op == '-' || op == '*' || op == '/' || op == '%') {
+
+ System.out.print("Enter one numbers : ");
+
+ int num1 = input.nextInt();
+
+ System.out.print("Enter two numbers : ");
+
+ int num2 = input.nextInt();
+
+ if (op == '+') {
+
+ ans = num1 + num2;
+
+ }
+
+ if (op == '-') {
+
+ ans = num1 - num2;
+
+ }
+
+ if (op == '*') {
+
+ ans = num1 * num2;
+
+ }
+
+ if (op == '/') {
+
+ if (num2 != 0) {
+
+ ans = num1 / num2;
+
+ }
+
+ }
+
+ if (op == '%') {
+
+ ans = num1 % num2;
+
+ }
+
+ } else if (op == 'x' || op == 'X') {
+
+ break;
+
+ }
+
+ System.out.println("Result = " + ans);
+
+ }
+
+ }
+
+}
diff --git a/Catalan.java b/Catalan.java
new file mode 100644
index 0000000..dd04ce6
--- /dev/null
+++ b/Catalan.java
@@ -0,0 +1,45 @@
+import java.util.Scanner;
+
+class Catalan {
+
+ // find nth Catalan number
+ public static int catalanDP(int n)
+ {
+
+ int cat[] = new int[n + 2];
+
+ // Initialize first two values in table
+ cat[0] = 1;
+ cat[1] = 1;
+
+ for (int i = 2; i <= n; i++) {
+ cat[i] = 0;
+ for (int j = 0; j < i; j++) {
+ cat[i] += cat[j] * cat[i - j - 1];
+ }
+ }
+
+ // Return last entry
+ return cat[n];
+ }
+
+ // Driver code
+ public static void main(String[] args)
+ {
+
+ // Catalan numbers are a sequence of positive integers, where the nth term in the sequence, denoted Cn,
+ // is found in the following formula: (2n)! / ((n + 1)!n!)
+
+ Scanner in = new Scanner(System.in);
+ System.out.println("Enter n (upto 20th catalan numbers will be printed): ");
+ int n = in.nextInt();
+ while(n>=20 || n<=0){
+ System.out.print("Enter n < 20: ");
+ n = in.nextInt();
+ }
+ in.close();
+ for (int i = 0; i < n; i++) {
+ System.out.print(catalanDP(i) + " ");
+ }
+ }
+}
diff --git a/CircularLinkedlist.cpp b/CircularLinkedlist.cpp
new file mode 100644
index 0000000..435efaf
--- /dev/null
+++ b/CircularLinkedlist.cpp
@@ -0,0 +1,68 @@
+#include
+using namespace std;
+
+/* structure for a node */
+class Node
+{
+ public:
+ int data;
+ Node *next;
+};
+
+/* Function to insert a node at the beginning
+of a Circular linked list */
+void push(Node **head_ref, int data)
+{
+ Node *ptr1 = new Node();
+ Node *temp = *head_ref;
+ ptr1->data = data;
+ ptr1->next = *head_ref;
+
+ /* If linked list is not NULL then
+ set the next of last node */
+ if (*head_ref != NULL)
+ {
+ while (temp->next != *head_ref)
+ temp = temp->next;
+ temp->next = ptr1;
+ }
+ else
+ ptr1->next = ptr1; /*For the first node */
+
+ *head_ref = ptr1;
+}
+
+/* Function to print nodes in
+a given Circular linked list */
+void printList(Node *head)
+{
+ Node *temp = head;
+ if (head != NULL)
+ {
+ do
+ {
+ cout << temp->data << " ";
+ temp = temp->next;
+ }
+ while (temp != head);
+ }
+}
+
+/* Driver program to test above functions */
+int main()
+{
+ /* Initialize lists as empty */
+ Node *head = NULL;
+
+ /* Created linked list will be 11->2->56->12 */
+ push(&head, 12);
+ push(&head, 56);
+ push(&head, 2);
+ push(&head, 11);
+
+ cout << "Contents of Circular Linked List\n ";
+ printList(head);
+
+ return 0;
+}
+
diff --git a/DECIMAL2HEXA b/DECIMAL2HEXA
new file mode 100644
index 0000000..6aee32c
--- /dev/null
+++ b/DECIMAL2HEXA
@@ -0,0 +1,28 @@
+import java.util.Scanner;
+
+public class JavaProgram
+{
+ public static void main(String args[])
+ {
+ int decnum, rem;
+ String hexdecnum="";
+
+
+ char hex[]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
+
+ Scanner scan = new Scanner(System.in);
+
+ System.out.print("Enter Decimal Number : ");
+ decnum = scan.nextInt();
+
+ while(decnum>0)
+ {
+ rem = decnum%16;
+ hexdecnum = hex[rem] + hexdecnum;
+ decnum = decnum/16;
+ }
+
+ System.out.print("Equivalent Hexadecimal Value of " + decnum + " is :\n");
+ System.out.print(hexdecnum);
+ }
+}
diff --git a/DesignCircularQueue.java b/DesignCircularQueue.java
new file mode 100644
index 0000000..f12c917
--- /dev/null
+++ b/DesignCircularQueue.java
@@ -0,0 +1,81 @@
+//Design Circular Queue
+
+ class MyCircularQueue {
+
+ private int[] data;
+ private int head;
+ private int tail;
+ private int size;
+
+ /** Initialize your data structure here. Set the size of the queue to be k. */
+ public MyCircularQueue(int k) {
+ data = new int[k];
+ head = -1;
+ tail = -1;
+ size = k;
+ }
+
+ /** Insert an element into the circular queue. Return true if the operation is successful. */
+ public boolean enQueue(int value) {
+ if (isFull() == true) {
+ return false;
+ }
+ if (isEmpty() == true) {
+ head = 0;
+ }
+ tail = (tail + 1) % size;
+ data[tail] = value;
+ return true;
+ }
+
+ /** Delete an element from the circular queue. Return true if the operation is successful. */
+ public boolean deQueue() {
+ if (isEmpty() == true) {
+ return false;
+ }
+ if (head == tail) {
+ head = -1;
+ tail = -1;
+ return true;
+ }
+ head = (head + 1) % size;
+ return true;
+ }
+
+ /** Get the front item from the queue. */
+ public int Front() {
+ if (isEmpty() == true) {
+ return -1;
+ }
+ return data[head];
+ }
+
+ /** Get the last item from the queue. */
+ public int Rear() {
+ if (isEmpty() == true) {
+ return -1;
+ }
+ return data[tail];
+ }
+
+ /** Checks whether the circular queue is empty or not. */
+ public boolean isEmpty() {
+ return head == -1;
+ }
+
+ /** Checks whether the circular queue is full or not. */
+ public boolean isFull() {
+ return ((tail + 1) % size) == head;
+ }
+}
+
+/**
+ * Your MyCircularQueue object will be instantiated and called as such:
+ * MyCircularQueue obj = new MyCircularQueue(k);
+ * boolean param_1 = obj.enQueue(value);
+ * boolean param_2 = obj.deQueue();
+ * int param_3 = obj.Front();
+ * int param_4 = obj.Rear();
+ * boolean param_5 = obj.isEmpty();
+ * boolean param_6 = obj.isFull();
+ */
diff --git a/Diamond_Pattern.java b/Diamond_Pattern.java
new file mode 100644
index 0000000..d260b43
--- /dev/null
+++ b/Diamond_Pattern.java
@@ -0,0 +1,39 @@
+import java.util.Scanner;
+public class Diamond
+{
+ public static void main(String args[])
+ {
+ int n, i, j, space = 1;
+ System.out.print("Enter the number of rows: ");
+ Scanner s = new Scanner(System.in);
+ n = s.nextInt();
+ space = n - 1;
+ for (j = 1; j <= n; j++)
+ {
+ for (i = 1; i <= space; i++)
+ {
+ System.out.print(" ");
+ }
+ space--;
+ for (i = 1; i <= 2 * j - 1; i++)
+ {
+ System.out.print("*");
+ }
+ System.out.println("");
+ }
+ space = 1;
+ for (j = 1; j <= n - 1; j++)
+ {
+ for (i = 1; i <= space; i++)
+ {
+ System.out.print(" ");
+ }
+ space++;
+ for (i = 1; i <= 2 * (n - j) - 1; i++)
+ {
+ System.out.print("*");
+ }
+ System.out.println("");
+ }
+ }
+}
\ No newline at end of file
diff --git a/DigitalRoot.java b/DigitalRoot.java
new file mode 100644
index 0000000..bdc51cc
--- /dev/null
+++ b/DigitalRoot.java
@@ -0,0 +1,92 @@
+/** Author : Suraj Kumar Modi
+ * https://github.com/skmodi649
+ */
+
+
+/** You are given a number n. You need to find the digital root of n.
+ * DigitalRoot of a number is the recursive sum of its digits until we get a single digit number.
+ *
+ * Test Case 1:
+ * Input:
+ * n = 1
+ * Output: 1
+ * Explanation: Digital root of 1 is 1
+ *
+ * Test Case 2:
+ * Input:
+ * n = 99999
+ * Output: 9
+ * Explanation: Sum of digits of 99999 is 45
+ * which is not a single digit number, hence
+ * sum of digit of 45 is 9 which is a single
+ * digit number.
+ */
+
+
+
+/** Algorithm :
+ * Step 1 : Define a method digitalRoot(int n)
+ * Step 2 : Define another method single(int n)
+ * Step 3 : digitalRoot(int n) method takes output of single(int n) as input
+ if(single(int n) <= 9)
+ return single(n)
+ else
+ return digitalRoot(single(n))
+ * Step 4 : single(int n) calculates the sum of digits of number n recursively
+ if(n<=9)
+ return n;
+ else
+ return (n%10) + (n/10)
+ * Step 5 : In main method simply take n as input and then call digitalRoot(int n) function and print the result
+ */
+
+
+
+
+
+
+
+import java.util.*;
+import java.io.*;
+import java.lang.*;
+
+class DigitalRoot
+{
+
+ public static int digitalRoot(int n)
+ {
+ if(single(n) <= 9) // If n is already single digit than simply call single method and return the value
+ return single(n);
+ else
+ return digitalRoot(single(n));
+ }
+
+
+
+ // This function is used for finding the sum of digits of number
+ public static int single(int n)
+ {
+ if(n<=9) // if n becomes less than 10 than return n
+ return n;
+ else
+ return (n % 10) + single(n / 10); // n % 10 for extracting digits one by one
+ } // n / 10 is the number obtainded after removing the digit one by one
+ // Sum of digits is stored in the Stack memory and then finally returned
+
+
+
+ public static void main(String[] args)
+ {
+ Scanner sc = new Scanner(System.in);
+ System.out.println("Enter the number : ");
+ int n = sc.nextInt(); // Taking a number as input from the user
+ System.out.println("Digital Root : "+digitalRoot(n)); // Printing the value returned by digitalRoot() method
+ }
+}
+
+
+/**
+ * Time Complexity : O((Number of Digits)^2)
+ * Auxiliary Space Complexity : O(Number of Digits)
+ * Constraints : 1 <= n <= 10^7
+ */
diff --git a/Echo.java b/Echo.java
index 7b96259..6b5f764 100644
--- a/Echo.java
+++ b/Echo.java
@@ -1,13 +1,10 @@
-class Echo
-{
- public static void main(String args[])
- {
- for(int i=0;i=1;i--)
+ {
+ fact=fact*i;
+ }
+ return fact;
+ }
+
+ public static void main(String arg[])
+ {
+ Scanner in = new Scanner(System.in);
+ System.out.println("Enter the number:");
+ int n = in.nextInt();
+ int f = fact(n);
+ System.out.println("Factorial of "+n+" is "+f);
+ }
+}
\ No newline at end of file
diff --git a/Fibonacci.java b/Fibonacci.java
index c963b59..7ee9f6a 100644
--- a/Fibonacci.java
+++ b/Fibonacci.java
@@ -1,16 +1,25 @@
-class FibonacciExample1{
-public static void main(String args[])
-{
- int n1=0,n2=1,n3,i,count=10;
- System.out.print(n1+" "+n2);//printing 0 and 1
-
- for(i=2;i 1) {
+ fact = true;
+ } else {
+ for (int i = 0; i < target.length(); i++) {
+
+ if (target.charAt(i) == tmp.charAt(0)) {
+ answer[i] = tmp.charAt(0);
+ isCorrect = true;
+ }
+ }
+ if (isCorrect == false) life--;
+ }
+ }
+
+ @Override
+ public String getOutput() {
+ if(fact == true){
+ fact = false;
+ return "One character only";
+ }
+ String temp="";
+ for (int i = 0; i a[i])
+ largest=l;
+ else
+ largest=i;
+
+ if(ra[largest])
+ largest=r;
+
+ if(largest !=i)
+ {
+ temp=a[largest];
+ a[largest]=a[i];
+ a[i]=temp;
+
+ heapify(a,largest,n);
+ }
+
+
+ }
+
+ public static void bheap(int a[])
+ {
+
+ for(int i=(a.length/2)-1;i>=0;i--)
+ {
+
+ heapify(a,i,a.length);
+
+ }
+
+ }
+
+ public static void Sort(int a[])
+ {
+ int temp,j,i;
+
+ bheap(a);
+
+ for( i=(a.length)-1; i>0;)
+ {
+ temp=a[0];
+ a[0]=a[i];
+ a[i]=temp;
+ heapify(a,0,i--) ;
+
+ }
+
+ }
+
+ public static void printarray(int a[])
+ {
+ System.out.println();
+ for (int j : a) {
+
+ System.out.print(j + " ");
+ }
+
+ }
+ public static void main(String[] args)
+ {
+ int n, res,i;
+ Scanner s = new Scanner(System.in);
+ System.out.print("Enter number of elements in the array:");
+ n = s.nextInt();
+ int[] a = new int[n];
+ System.out.println("Enter "+n+" elements ");
+ for( i=0; i < n; i++)
+ {
+ a[i] = s.nextInt();
+ }
+
+ System.out.println( "elements in array ");
+ printarray(a);
+ Sort(a);
+ System.out.println( "\nelements after sorting");
+ printarray(a);
+
+ }
+}
diff --git a/JavaApplets/FirstApplet.htm b/JavaApplets/FirstApplet.htm
new file mode 100755
index 0000000..56a604f
--- /dev/null
+++ b/JavaApplets/FirstApplet.htm
@@ -0,0 +1,10 @@
+
+
+ First Applet
+
+
+
+
+
\ No newline at end of file
diff --git a/JavaApplets/FirstApplet.java b/JavaApplets/FirstApplet.java
new file mode 100755
index 0000000..9638536
--- /dev/null
+++ b/JavaApplets/FirstApplet.java
@@ -0,0 +1,31 @@
+/*
+
+*/
+
+import java.applet.Applet;
+import java.awt.*;
+
+public class FirstApplet extends Applet{
+ // public void init(){}
+ public void paint(Graphics g) {
+ g.drawString("Hello World", 10, 10);
+ }
+}
+
+// code: Name of applet class file.
+// width: Width of applet.
+// height: Height of applet.
+// codebase: Directory path for applet code eg:'/Applets'.
+// alt: Text to show if applet failed to load.
+// name: Name of applet.
+// align: Setting alignment of the applet.
diff --git a/JavaApplets/GraphicsMethods.java b/JavaApplets/GraphicsMethods.java
new file mode 100755
index 0000000..51973a3
--- /dev/null
+++ b/JavaApplets/GraphicsMethods.java
@@ -0,0 +1,82 @@
+//
+
+import java.applet.Applet;
+import java.awt.*;
+
+public class GraphicsMethods extends Applet{
+ public void paint(Graphics g) {
+
+// int getWidth();
+ int w = getWidth();
+// int getHeight();
+ int h = getHeight();
+// Dimension getSize();
+ Dimension d = getSize();
+ double wD = d.getWidth();
+ double hD = d.getHeight();
+
+ if(w == wD && h == hD) {
+// void drawString("Message", x, y);
+ g.drawString("(" + w + ", " + h + ")", 10, 10);
+ }
+
+ Font f = new Font("Arial", Font.PLAIN, 28);
+// void setFont(Font f);
+ g.setFont(f);
+
+// void setBackground(Color c);
+ setBackground(Color.WHITE);
+
+ // Color c = new Color(78, 32, 91);
+// void setForeground(Color c);
+ setForeground(new Color(78, 32, 91)); // Anonymous Object
+
+// void drawLine(int x1, int y1, int x2, int y2);
+ g.drawLine(10, 50, 100, 50);
+
+// void drawRect(int x, int y, int width, int height);
+ g.drawRect(10, 100, 100, 70);
+
+// void fillRect(int x, int y, int width, int height);
+ g.fillRect(150, 100, 100, 70);
+
+// void draw3DRect(int x, int y, int width, int height, boolean raised);
+ g.draw3DRect(10, 200, 100, 70, true);
+
+// void fill3DRect(int x, int y, int width, int height, boolean raised);
+ g.fill3DRect(150, 200, 100, 70, true);
+
+// void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight);
+ g.drawRoundRect(10, 300, 100, 70, 25, 25);
+
+// void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight);
+ g.fillRoundRect(150, 300, 100, 70, 25, 25);
+
+// void drawOval(int x, int y, int xDia, int yDia);
+ g.drawOval(10, 400, 100, 70);
+
+// void fillOval(int x, int y, int xDia, int yDia);
+ g.fillOval(150, 400, 100, 70);
+
+// void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle);
+ g.drawArc(150, 50, 100, 100, 45, 90);
+
+ int x1[] = {10, 30, 60, 90, 100, 150};
+ int y1[] = {500, 520, 500, 530, 500, 520};
+// void drawPolyLine(int[] x, int[] y, int numSides);
+ g.drawPolyline(x1, y1, 5);
+
+ int x2[] = {150, 170, 200, 230, 240, 290};
+ int y2[] = {500, 520, 500, 530, 520, 520};
+// void drawPolygon(int[] x, int[] y, int numSides);
+ g.drawPolygon(x2, y2, 5);
+ }
+}
diff --git a/JavaApplets/test.txt b/JavaApplets/test.txt
new file mode 100755
index 0000000..770bd3e
--- /dev/null
+++ b/JavaApplets/test.txt
@@ -0,0 +1,11 @@
+
+
+
diff --git a/KBC-quiz.java b/KBC-quiz.java
new file mode 100644
index 0000000..bb5d365
--- /dev/null
+++ b/KBC-quiz.java
@@ -0,0 +1,302 @@
+// Kashish Ahuja - codeitmin
+
+// KBC Quiz
+/* Take 10 questions: core java based questions
+Two life lines: 50-50, change the question
+Show total money won */
+
+import java.util.Scanner;
+import static java.lang.System.out;
+import static java.lang.System.in;
+import javax.swing.JOptionPane;
+
+class KBC
+{
+ static
+ {
+ out.println("Welcome to KBC... ");
+ }
+
+ static Scanner sc = new Scanner(in);
+
+ public static int check(String userAns, String correctAns, int m)
+ {
+ if(userAns.equalsIgnoreCase("FF"))
+ {
+ JOptionPane.showMessageDialog(null,"\n50-50 life line activated");
+ return 2;
+ }
+
+ else if(userAns.equalsIgnoreCase("CTQ"))
+ {
+ JOptionPane.showMessageDialog(null,"\nChange the question life line activated");
+ JOptionPane.showMessageDialog(null,"New Question...");
+ return 1;
+ }
+
+ else
+ {
+ if(userAns.equals(correctAns))
+ {
+ JOptionPane.showMessageDialog(null,"\nThat's the right answer.");
+ if(m!=10)
+ {
+ JOptionPane.showMessageDialog(null,"Total money won: Rs " + m +"0 lakh");
+ return 0;
+ }
+ else
+ {
+ JOptionPane.showMessageDialog(null,"Total money won: Rs 1Cr");
+ JOptionPane.showMessageDialog(null,"You are now a CrorePati");
+ JOptionPane.showMessageDialog(null,"ParttYYY Brroooo");
+ return 0;
+ }
+ }
+ else
+ {
+ JOptionPane.showMessageDialog(null,"\nThat's not the right answer. You lost.");
+ JOptionPane.showMessageDialog(null,"Total money won: Rs " + (m-1) +"0 lakh");
+ System.exit(0);
+ return 0;
+ }
+ }
+ }
+
+ public static String lifeLine(boolean ff, boolean ctq)
+ {
+ if(ff==true)
+ {
+ if(ctq==true)
+ return "\nLife line: 50-50 : FF, Change the question : CTQ";
+ else
+ return "\nLife line: 50-50 : FF";
+ }
+ else if(ctq==true)
+ return "\nLife line: Change the question : CTQ";
+ else
+ return "\nLife line: No life lines left";
+ }
+
+ public static void questions()
+ {
+ String ans;
+ int money=0, chk;
+ boolean ff=true, ctq=true;
+
+ ans=JOptionPane.showInputDialog("\nWhich of these is not a phase of Agile approach? \nA) Application Database making \nB) Application Analysis \nC)Application Marketing \nD) Application Launching \n" + lifeLine(ff, ctq));
+ money++;
+ chk=check(ans, "C", money);
+ if(chk==1)
+ {
+ money--;
+ ctq=false;
+ }
+ else if(chk==2)
+ {
+ ff=false;
+ ans=JOptionPane.showInputDialog("\nWhich of these is not a phase of Agile approach \nA) \nB) Application Analysis \nC)Application Marketing \nD) \n"+ lifeLine(ff,ctq));
+ if(check(ans, "C", money)==1)
+ {
+ money--;
+ ctq=false;
+ }
+ }
+
+ ans=JOptionPane.showInputDialog("\nJava can not be defined as: ? \nA) Annotation programming \nB) Purely object oriented programming \nC) Object oriented programming \n D)Automation oriented programming\n"+ lifeLine(ff,ctq));
+ money++;
+ chk=check(ans, "D", money);
+ if(chk==1)
+ {
+ money--;
+ ctq=false;
+ }
+ else if(chk==2)
+ {
+ ff=false;
+ ans=JOptionPane.showInputDialog("\nJava can not be defined as: ? \nA) Annotation programming \nB) \nC) \nD)Automation oriented programming\n"+ lifeLine(ff,ctq));
+ if(check(ans, "D", money)==1)
+ {
+ money--;
+ ctq=false;
+ }
+ }
+
+ ans=JOptionPane.showInputDialog("\nJVM is an: ?\nA) Compiler \nB)Interpreter \nC) Both \n D) None\n"+ lifeLine(ff,ctq));
+ money++;
+ chk=check(ans, "B", money);
+ if(chk==1)
+ {
+ money--;
+ ctq=false;
+ }
+ else if(chk==2)
+ {
+ ff=false;
+ ans=JOptionPane.showInputDialog("\nJVM is an: ?\nA) Compiler \nB)Interpreter \nC) \nD) \n"+ lifeLine(ff,ctq));
+ if(check(ans, "B", money)==1)
+ {
+ money--;
+ ctq=false;
+ }
+ }
+
+
+ ans=JOptionPane.showInputDialog("\nWhich of these is not a non-access level in java? \nA)Transition \nB) Strictfp \nC) Final \nD) Static\n"+ lifeLine(ff,ctq));
+ money++;
+ chk=check(ans, "A", money);
+ if(chk==1)
+ {
+ money--;
+ ctq=false;
+ }
+ else if(chk==2)
+ {
+ ff=false;
+ ans=JOptionPane.showInputDialog("\nWhich of these is not a non-access level in java? \nA)Transition \nB) \nC) Final \nD) \n"+ lifeLine(ff,ctq));
+ if(check(ans, "A", money)==1)
+ {
+ money--;
+ ctq=false;
+ }
+ }
+
+ ans=JOptionPane.showInputDialog("\nWhich of these is not a method provided by Scanner class? \nA) nextShort() \nB) nextLine() \nC)nextChar() \nD) nextBoolean()\n"+ lifeLine(ff,ctq));
+ money++;
+ chk=check(ans, "C", money);
+ if(chk==1)
+ {
+ money--;
+ ctq=false;
+ }
+ else if(chk==2)
+ {
+ ff=false;
+ ans=JOptionPane.showInputDialog("\nWhich of these is not a method provided by Scanner class? \nA) nextShort() \nB) \nC)nextChar() \nD) \n"+ lifeLine(ff,ctq));
+ if(check(ans, "C", money)==1)
+ {
+ money--;
+ ctq=false;
+ }
+ }
+
+ ans=JOptionPane.showInputDialog("\nIn java everything by default is of type? \nA) Public \nB) Private \nC) Protected \nD)Default\n"+ lifeLine(ff,ctq));
+ money++;
+ chk=check(ans, "D", money);
+ if(chk==1)
+ {
+ money--;
+ ctq=false;
+ }
+ else if(chk==2)
+ {
+ ff=false;
+ ans=JOptionPane.showInputDialog("\nIn java everything by default is of type?\nA) Public \nB) \nC) \nD)Default\n"+ lifeLine(ff,ctq));
+ if(check(ans, "D", money)==1)
+ {
+ money--;
+ ctq=false;
+ }
+ }
+
+ ans=JOptionPane.showInputDialog("\nWhich of these is not a way of importing packages?\nA)Runtime \nB) Global \nC) Static \n D) Non-static\n"+ lifeLine(ff,ctq));
+ money++;
+ chk=check(ans, "A", money);
+ if(chk==1)
+ {
+ money--;
+ ctq=false;
+ }
+ else if(chk==2)
+ {
+ ff=false;
+ ans=JOptionPane.showInputDialog("\nWhich of these is not a way of importing packages?\nA)Runtime \nB) Global \nC) \n D) \n"+ lifeLine(ff,ctq));
+ if(check(ans, "A", money)==1)
+ {
+ money--;
+ ctq=false;
+ }
+ }
+
+ ans=JOptionPane.showInputDialog("\nWhich of these is a way of identifying an object in java?\nA) classname name \nB)new classname \nC) uppercase \n D) datatype name\n"+ lifeLine(ff,ctq));
+ money++;
+ chk=check(ans, "B", money);
+ if(chk==1)
+ {
+ money--;
+ ctq=false;
+ }
+ else if(chk==2)
+ {
+ ff=false;
+ ans=JOptionPane.showInputDialog("\nWhich of these is a way of identifying an object in java?\nA) classname name \nB)new classname \nC) \n D)\n"+ lifeLine(ff,ctq));
+ if(check(ans, "B", money)==1)
+ {
+ money--;
+ ctq=false;
+ }
+ }
+
+ ans=JOptionPane.showInputDialog("\nWhich of these java classes does not contain format() method?\nA) String \nB) DateFormat \nC)LocalDateFormat \nD) NumberFormat\n"+ lifeLine(ff,ctq));
+ money++;
+ chk=check(ans, "C", money);
+ if(chk==1)
+ {
+ money--;
+ ctq=false;
+ }
+ else if(chk==2)
+ {
+ ff=false;
+ ans=JOptionPane.showInputDialog("\nWhich of these java classes does not contain format() method?\nA) \nB) \nC)LocalDateFormat \nD) NumberFormat\n"+ lifeLine(ff,ctq));
+ if(check(ans, "C", money)==1)
+ {
+ money--;
+ ctq=false;
+ }
+ }
+
+ ans=JOptionPane.showInputDialog("\nWhat is the correct output of DateFormat class with LONG static constant?\nA) 8/17/21 \nB)August 17, 2021 \nC) Tuesday, August, 17, 2021 \nD) Aug 17, 2021\n"+ lifeLine(ff,ctq));
+ money++;
+ chk=check(ans, "B", money);
+ if(chk==1)
+ {
+ money--;
+ ctq=false;
+ }
+ else if(chk==2)
+ {
+ ff=false;
+ ans=JOptionPane.showInputDialog("\nWhat is the correct output of DateFormat class with LONG static constant?\nA) \nB)August 17, 2021 \nC) Tuesday, August, 17, 2021 \n D)\n"+ lifeLine(ff,ctq));
+ if(check(ans, "B", money)==1)
+ {
+ money--;
+ ctq=false;
+ }
+ }
+
+ ans=JOptionPane.showInputDialog("\nWhat is these dialog box method does not require null?\nA)showInputDialog() \nB) showMessageDialog() \nC) showConfirmDialog() \nD) showGraphicDialog()\n"+ lifeLine(ff,ctq));
+ money++;
+ chk=check(ans, "A", money);
+ if(chk==1)
+ {
+ money--;
+ ctq=false;
+ }
+ else if(chk==2)
+ {
+ ff=false;
+ ans=JOptionPane.showInputDialog("\nWhat is these dialog box method does not require null?\nA)showInputDialog() \nB) \nC) showConfirmDialog() \nD) \n"+ lifeLine(ff,ctq));
+ if(check(ans, "A", money)==1)
+ {
+ money--;
+ ctq=false;
+ }
+ }
+ }
+
+ static public void main(String...args)
+ {
+ JOptionPane.showMessageDialog(null, "Welcome to KBC...");
+ questions();
+ }
+}
\ No newline at end of file
diff --git a/K_equal_sum_subset.java b/K_equal_sum_subset.java
new file mode 100644
index 0000000..b188a64
--- /dev/null
+++ b/K_equal_sum_subset.java
@@ -0,0 +1,39 @@
+public class K_equal_sum_subset {
+ //helper function
+ boolean helpInPartition(int nums[],boolean visited[],int start,int k,int currentSum,int targetSum)
+ {
+ //when there are no more subsets left to make
+ if(k==0)
+ return true;
+ if(currentSum>targetSum)
+ return false;
+ //if current sum equals target sum,we are left with k-1 subsets to make
+ if(currentSum==targetSum)
+ return helpInPartition(nums,visited,0,k-1,0,targetSum);
+ for(int j=start;j= grid.length || j < 0 || j >= grid[i].length || grid[i][j] == 0) {
+ return 0;
+ }
+
+ grid[i][j] = 0;
+ int count = 1;
+ count += dfs(grid, i + 1, j);
+ count += dfs(grid, i - 1, j);
+ count += dfs(grid, i, j + 1);
+ count += dfs(grid, i, j - 1);
+
+ return count;
+ }
+}
diff --git a/MergeTwoSortedLists.java b/MergeTwoSortedLists.java
new file mode 100644
index 0000000..bdb408a
--- /dev/null
+++ b/MergeTwoSortedLists.java
@@ -0,0 +1,54 @@
+import java.util.List;
+import java.util.LinkedList;
+
+
+public class MergeTwoSortedLists {
+ public static void main(String[] args) {
+ List list1 = new LinkedList<>();
+
+ List list2 = new LinkedList<>();
+
+ List resultList = new LinkedList<>();
+
+ list1.add(1);
+ list1.add(3);
+ list1.add(6);
+
+ list2.add(2);
+ list2.add(4);
+ list2.add(5);
+
+ int i = 0;
+ int j = 0;
+
+ while(i < list1.size() && j < list2.size()){
+ if(list1.get(i) < list2.get(j)){
+ resultList.add(list1.get(i));
+ i++;
+ }
+
+ else{
+ resultList.add(list2.get(j));
+ j++;
+ }
+ }
+
+ while(i < list1.size()){
+ resultList.add(list1.get(i));
+ i++;
+ }
+
+ while(j < list2.size()){
+ resultList.add(list2.get(j));
+ j++;
+ }
+
+ System.out.print("Resulting List After the Merging the Two Sorted Lists : ");
+
+ for(int k = 0;k Accelerate/ Break)
+// He/she does not bather about how the Accelerate/ brake mechanism works internally. This is how the abstraction works.
+
+// Abstract class
+public abstract class Car {
+ public abstract void stop();
+}
+
+// Concrete class
+public class Ford extends Car {
+ // Hiding implementation details
+ @Override
+ public void stop(){
+ System.out.println("Ford::Stop");
+ }
+}
+
+public class Main {
+ public static void main(String args[]){
+ Car obj = new Ford(); // Car object
+ obj.stop(); // Call the method
+ }
+}
+
diff --git a/OOP Concepts/Encapsulation.java b/OOP Concepts/Encapsulation.java
new file mode 100644
index 0000000..88a307f
--- /dev/null
+++ b/OOP Concepts/Encapsulation.java
@@ -0,0 +1,38 @@
+//Encapsulation is the process of wrapping code and data together into a single unit.
+//Just like a capsule which is mixed of several medicines. The medicines are hidden data to the end user.
+
+// A Java class which is a fully encapsulated class.
+public class Car{
+
+ // private variable (Could not access directly)
+ private String name;
+
+ // getter method for name
+ public String getName() {
+ return name;
+ }
+
+ // setter method for name
+ public void setName(String name){
+ this.name = name
+ }
+
+}
+
+
+// Java class to test the encapsulated class.
+public class Test{
+
+ public static void main(String[] args){
+
+ // creating instance of the encapsulated class
+ Car car = new Car();
+
+ // setting value in the name member
+ car.setName("Ford");
+
+ // getting value of the name member
+ System.out.println(car.getName());
+ }
+
+}
diff --git a/OOP Concepts/Inheritance.java b/OOP Concepts/Inheritance.java
new file mode 100644
index 0000000..b91717d
--- /dev/null
+++ b/OOP Concepts/Inheritance.java
@@ -0,0 +1,70 @@
+//Inheritance is the process of one class inheriting properties and methods from another class in Java.
+//It's just like father and son relationship.
+//Son inherit fathers things as well as things of his own
+//Here is a Car example senario to that
+
+
+// super class
+class Car {
+ // the Car class have one field
+ public String wheelStatus;
+ public int noOfWheels;
+
+ // the Car class has one constructor
+ public Car(String wheelStatus, int noOfWheels)
+ {
+ this.wheelStatus = wheelStatus;
+ this.noOfWheels = noOfWheels;
+ }
+
+ // the Car class has three methods
+ public void applyBrake()
+ {
+ wheelStatus = "Stop"
+ }
+
+ // toString() method to print info of Car
+ public String toString()
+ {
+ return ("No of wheels in car " + noOfWheels + "\n"
+ + "status of the wheels " + wheelStatus);
+ }
+}
+
+// sub class
+class Ford extends Car {
+
+ // the Ford subclass adds one more field
+ public Boolean alloyWheel;
+
+ // the Ford subclass has one constructor
+ public Ford(String wheelStatus, int noOfWheels,
+ Boolean alloyWheel)
+ {
+ // invoking super-class(Car) constructor
+ super(wheelStatus, noOfWheels);
+ alloyWheel = alloyWheel;
+ }
+
+ // the Ford subclass adds one more method
+ public void setAlloyWheel(Boolean alloyWheel)
+ {
+ alloyWheel = alloyWheel;
+ }
+
+ // overriding toString() method of Car to print more info
+ @Override
+ public String toString(){
+ return (super.toString() + "\nCar alloy wheel "
+ + alloyWheel);
+ }
+}
+
+// driver class
+public class Main {
+ public static void main(String args[]){
+
+ Ford ford = new Ford(3, 100, 25);
+ System.out.println(ford.toString());
+ }
+}
diff --git a/OOP Concepts/Polymorphism.java b/OOP Concepts/Polymorphism.java
new file mode 100644
index 0000000..bf9b8e0
--- /dev/null
+++ b/OOP Concepts/Polymorphism.java
@@ -0,0 +1,13 @@
+//Polymorphism is the ability to perform many things in many ways.
+public class Car{
+
+ public void speed() {
+ }
+
+ public void speed(String accelerator) {
+ }
+
+ public int speed(String accelerator, int speedUp) {
+ return carSpeed;
+ }
+}
diff --git a/PalindromicNumber.java b/PalindromicNumber.java
new file mode 100644
index 0000000..b2b49f3
--- /dev/null
+++ b/PalindromicNumber.java
@@ -0,0 +1,20 @@
+import java.util.*;
+
+class Solution {
+ public boolean isPalindrome(int x) {
+ if(x < 0) return false;
+ String number = String.valueOf(x);
+ String[] temp = new String[number.length()];
+ String[] tempReverse = new String[number.length()];
+ for(int i = 0; i < number.length(); i++){
+ temp[i] = String.valueOf(number.charAt(i));
+ tempReverse[number.length()-i-1] = String.valueOf(number.charAt(i));
+ }
+ for(int i = 0; i < numberf.length(); i++){
+ if(!temp[i].equals(tempReverse[i])){
+ return false;
+ }
+ }
+ return true;
+ }
+}
diff --git a/PeakIndex.java b/PeakIndex.java
new file mode 100644
index 0000000..3e3331b
--- /dev/null
+++ b/PeakIndex.java
@@ -0,0 +1,27 @@
+//https://leetcode.com/problems/peak-index-in-a-mountain-array/
+
+class Solution {
+ public int peakIndexInMountainArray(int[] arr) {
+ int start = 0;
+ int end = arr.length - 1;
+
+ while(start < end) {
+ int mid = start + (end - start) / 2;
+ if(arr[mid] > arr[mid+1]) {
+ // you are in dec part of the array
+ // this may be the ans, but look at left
+ end = mid;
+ } else {
+ // arr[mid + 1] > arr[mid]
+ // you are in inc part of the array
+ start = mid + 1;
+ }
+ }
+
+ // In the end, start == end and pointing to the largest number because of the 2 checks
+ // start and end are always trying to find max element in the above 2 checks
+ // hence, when they are pointing to just one element, that is the max element
+ // At every point of time of start and end, there may be a best possible ans at that particular time
+ return end;
+ }
+}
diff --git a/PrimeNumber.java b/PrimeNumber.java
new file mode 100644
index 0000000..87eecdd
--- /dev/null
+++ b/PrimeNumber.java
@@ -0,0 +1,23 @@
+import java.util.*;
+public class PrimeNumber{
+ public static void main(String arg[])
+ {
+ Scanner in = new Scanner(System.in);
+ System.out.println("Enter the Number:");
+ int num = in.nextInt();
+ int flag=0;
+ for(int i =2;ipivot)
- {
+ while(a[end]>pivot) {
end--;
}
- if(start
+
+
+
+
+
+
+
+
+#Java_Programs :coffee:
+
+Java is a high-level, class-based, object-oriented programming language that is designed
+to have as few implementation dependencies as possible. It is a general-purpose programming
+language intended to let programmers write once, run anywhere (WORA), meaning that
+compiled Java code can run on all platforms that support Java without the need for recompilation.
+
+Java applications are typically compiled to bytecode that can run on any Java virtual
+machine (JVM) regardless of the underlying computer architecture. The syntax of Java is similar
+to C and C++, but has fewer low-level facilities than either of them. The Java runtime provides
+dynamic capabilities (such as reflection and runtime code modification) that are typically not
+available in traditional compiled languages. As of 2019, Java was one of the most popular
+programming languages in use according to GitHub, particularly for client-server web
+applications, with a reported 9 million developers.
+
+Source: https://en.wikipedia.org/wiki/Java_(programming_language)
+
+
diff --git a/RSA.java b/RSA.java
new file mode 100644
index 0000000..4b0dead
--- /dev/null
+++ b/RSA.java
@@ -0,0 +1,73 @@
+package Ciphers;
+
+import java.math.BigInteger;
+import java.security.SecureRandom;
+import javax.swing.JOptionPane;
+
+public final class RSA {
+
+ public static void main(String[] args) {
+
+ RSA rsa = new RSA(1024);
+ String text1 = JOptionPane.showInputDialog("Enter a message to encrypt :");
+
+ String ciphertext = rsa.encrypt(text1);
+ JOptionPane.showMessageDialog(null, "Your encrypted message : " + ciphertext);
+
+ JOptionPane.showMessageDialog(null, "Your message after decrypt : " + rsa.decrypt(ciphertext));
+ }
+
+ private BigInteger modulus, privateKey, publicKey;
+
+ public RSA(int bits) {
+ generateKeys(bits);
+ }
+
+ /**
+ * @return encrypted message
+ */
+ public synchronized String encrypt(String message) {
+ return (new BigInteger(message.getBytes())).modPow(publicKey, modulus).toString();
+ }
+
+ /**
+ * @return encrypted message as big integer
+ */
+ public synchronized BigInteger encrypt(BigInteger message) {
+ return message.modPow(publicKey, modulus);
+ }
+
+ /**
+ * @return plain message
+ */
+ public synchronized String decrypt(String encryptedMessage) {
+ return new String((new BigInteger(encryptedMessage)).modPow(privateKey, modulus).toByteArray());
+ }
+
+ /**
+ * @return plain message as big integer
+ */
+ public synchronized BigInteger decrypt(BigInteger encryptedMessage) {
+ return encryptedMessage.modPow(privateKey, modulus);
+ }
+
+ /**
+ * Generate a new public and private key set.
+ */
+ public synchronized void generateKeys(int bits) {
+ SecureRandom r = new SecureRandom();
+ BigInteger p = new BigInteger(bits / 2, 100, r);
+ BigInteger q = new BigInteger(bits / 2, 100, r);
+ modulus = p.multiply(q);
+
+ BigInteger m = (p.subtract(BigInteger.ONE)).multiply(q.subtract(BigInteger.ONE));
+
+ publicKey = new BigInteger("3");
+
+ while (m.gcd(publicKey).intValue() > 1) {
+ publicKey = publicKey.add(new BigInteger("2"));
+ }
+
+ privateKey = publicKey.modInverse(m);
+ }
+}
diff --git a/Rabin_Karp_Problem.java b/Rabin_Karp_Problem.java
new file mode 100644
index 0000000..ee2bb0a
--- /dev/null
+++ b/Rabin_Karp_Problem.java
@@ -0,0 +1,82 @@
+module Rabin_Karp_Problem {
+ // Following program is a Java implementation
+ // of Rabin Karp Algorithm given in the CLRS book
+
+ public class Main {
+ // d is the number of characters in the input alphabet
+ public final static int d = 256;
+
+ /* pat -> pattern
+ txt -> text
+ q -> A prime number
+ */
+ static void search(String pat, String txt, int q)
+ {
+ int M = pat.length();
+ int N = txt.length();
+ int i, j;
+ int p = 0; // hash value for pattern
+ int t = 0; // hash value for txt
+ int h = 1;
+
+ // The value of h would be "pow(d, M-1)%q"
+ for (i = 0; i < M - 1; i++)
+ h = (h * d) % q;
+
+ // Calculate the hash value of pattern and first
+ // window of text
+ for (i = 0; i < M; i++) {
+ p = (d * p + pat.charAt(i)) % q;
+ t = (d * t + txt.charAt(i)) % q;
+ }
+
+ // Slide the pattern over text one by one
+ for (i = 0; i <= N - M; i++) {
+
+ // Check the hash values of current window of
+ // text and pattern. If the hash values match
+ // then only check for characters one by one
+ if (p == t) {
+ /* Check for characters one by one */
+ for (j = 0; j < M; j++) {
+ if (txt.charAt(i + j) != pat.charAt(j))
+ break;
+ }
+
+ // if p == t and pat[0...M-1] = txt[i, i+1,
+ // ...i+M-1]
+ if (j == M)
+ System.out.println(
+ "Pattern found at index " + i);
+ }
+
+ // Calculate hash value for next window of text:
+ // Remove leading digit, add trailing digit
+ if (i < N - M) {
+ t = (d * (t - txt.charAt(i) * h)
+ + txt.charAt(i + M))
+ % q;
+
+ // We might get negative value of t,
+ // converting it to positive
+ if (t < 0)
+ t = (t + q);
+ }
+ }
+ }
+
+ /* Driver Code */
+ public static void main(String[] args)
+ {
+ String txt = "GEEKS FOR GEEKS";
+ String pat = "GEEK";
+
+ // A prime number
+ int q = 101;
+
+ // Function Call
+ search(pat, txt, q);
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/RadixSort.java b/RadixSort.java
new file mode 100644
index 0000000..3de40f3
--- /dev/null
+++ b/RadixSort.java
@@ -0,0 +1,48 @@
+package Sorts;
+
+import java.util.Arrays;
+
+class RadixSort {
+
+ private static int getMax(int[] arr, int n) {
+ int mx = arr[0];
+ for (int i = 1; i < n; i++) if (arr[i] > mx) mx = arr[i];
+ return mx;
+ }
+
+ private static void countSort(int[] arr, int n, int exp) {
+ int[] output = new int[n];
+ int i;
+ int[] count = new int[10];
+ Arrays.fill(count, 0);
+
+ for (i = 0; i < n; i++) count[(arr[i] / exp) % 10]++;
+
+ for (i = 1; i < 10; i++) count[i] += count[i - 1];
+
+ for (i = n - 1; i >= 0; i--) {
+ output[count[(arr[i] / exp) % 10] - 1] = arr[i];
+ count[(arr[i] / exp) % 10]--;
+ }
+
+ for (i = 0; i < n; i++) arr[i] = output[i];
+ }
+
+ private static void radixsort(int[] arr, int n) {
+
+ int m = getMax(arr, n);
+
+ for (int exp = 1; m / exp > 0; exp *= 10) countSort(arr, n, exp);
+ }
+
+ static void print(int[] arr, int n) {
+ for (int i = 0; i < n; i++) System.out.print(arr[i] + " ");
+ }
+
+ public static void main(String[] args) {
+ int[] arr = {170, 45, 75, 90, 802, 24, 2, 66};
+ int n = arr.length;
+ radixsort(arr, n);
+ print(arr, n);
+ }
+}
\ No newline at end of file
diff --git a/RandomNumber.java b/RandomNumber.java
new file mode 100644
index 0000000..a72340a
--- /dev/null
+++ b/RandomNumber.java
@@ -0,0 +1,23 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.mycompany.worksheet1;
+
+/**
+ *
+ * @author Shanmuga Priya M
+ */
+public class randomno {
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String[] args) {
+ int a= (int)((Math.random()*10));
+ System.out.println(a);
+ // TODO code application logic here
+ }
+
+}
diff --git a/ReverseArray.java b/ReverseArray.java
new file mode 100644
index 0000000..48a03ae
--- /dev/null
+++ b/ReverseArray.java
@@ -0,0 +1,33 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package com.mycompany.worksheet1;
+
+import java.util.Scanner;
+
+/**
+ *
+ * @author Shanmuga Priya M
+ */
+public static void main(String[] args) {
+ int a[]=new int[10];
+ int riv_a[]=new int[10];
+ int n,i;
+ Scanner obj= new Scanner(System.in);
+ System.out.println("enter size of array : ");
+ n=obj.nextInt();
+ System.out.println("enter elements of array : ");
+ for(i=0;i e) {
+ return -1;
+ }
+
+ int m = s + (e-s) / 2;
+ if(arr[m] == target) {
+ return m;
+ }
+
+ if(arr[s] <= arr[m]) {
+ if(target >= arr[s] && target <= arr[m]) {
+ return search(arr, target, s, m-1);
+ } else {
+ return search(arr, target, m+1, e);
+ }
+ }
+
+ if(target >= arr[m] && target <= arr[e]) {
+ return search(arr, target, m+1, e);
+ }
+
+ return search(arr, target, s, m-1);
+ }
+}
diff --git a/Searching.java b/Searching.java
new file mode 100644
index 0000000..f1f6383
--- /dev/null
+++ b/Searching.java
@@ -0,0 +1,37 @@
+import java.util.Scanner;
+public class Searching {
+ public static int search(int arr[], int x) {
+ for (int i = 0; i < arr.length; i++) {
+ if (arr[i] == x) {
+ return i;
+ }
+ }
+ return -1;
+ }
+ public static void main(String[] args) {
+ Scanner input = new Scanner(System.in);
+ int arr[] = {
+ 10,
+ 20,
+ 30,
+ 40,
+ 50,
+ 60,
+ 70,
+ 80,
+ 90,
+ 100
+ };
+ System.out.print("Enter the number: ");
+ int x = input.nextInt();
+ System.out.println();
+
+ int result = search(arr, x);
+ if (result == -1) {
+ System.out.println("Sorry, data not found");
+ } else {
+ System.out.println("Number " + x + " in index " + search(arr, x) + "");
+ }
+ }
+
+}
diff --git a/SelectionSort10 b/SelectionSort10
new file mode 100644
index 0000000..1db46bd
--- /dev/null
+++ b/SelectionSort10
@@ -0,0 +1,41 @@
+import java.io.*;
+
+public class SelectionSort10 {
+ public static void selsort(int A[]) {
+ int i, j, small, tmp, pos;
+ for (i = 0; i < 10; i++) {
+ small = A[i];
+ pos = i;
+ for (j = i + 1; j < 10; j++) {
+ if (A[j] < small) {
+ small = A[j];
+ pos = j;
+ }
+ }
+ tmp = A[i];
+ A[i] = A[pos];
+ A[pos] = tmp;
+ }
+ System.out.println("Array in ascending order=");
+ for (i = 0; i < 10; i++)
+ System.out.println(A[i]);
+ }
+
+ public static void main(String[] args) {
+ int A[] = new int[10];
+ BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
+ String inStr = null;
+ System.out.println("Enter 10 elements of array=");
+ try {
+ for (int i = 0; i < 10; i++) {
+ inStr = buf.readLine();
+ A[i] = Integer.parseInt(inStr);
+ }
+ } catch (Exception e) {
+ System.out.println("Error in data entry");
+ System.out.println("Exception=" + e);
+ return;
+ }
+ selsort(A);
+ }
+}
diff --git a/ShellSort.java b/ShellSort.java
index f7a86c4..1dc9b79 100644
--- a/ShellSort.java
+++ b/ShellSort.java
@@ -1,37 +1,29 @@
-public class ShellSort
-{
- public static void main(String[] args)
- {
+public class ShellSort {
+ public static void main(String[] args) {
int a[]={25,-17,8,92,-21,0};
- for(int gap=a.length/2;gap>0;gap/=2)
- {
-
- for(int i=gap;i0;gap/=2) {
+ for(int i=gap;i=gap &&a[j-gap]>tmp)
- {
+ while(j>=gap &&a[j-gap]>tmp) {
a[j]=a[j-gap];
j-=gap;
}
a[j]=tmp;
-
}
}
-
- System.out.println("Sorted Array : ");
- System.out.print("[");
- for(int i=0;i spiralOrder(int[][] matrix)
+ {
+ List ans = new ArrayList();
+
+ if (matrix.length == 0)
+ return ans;
+
+ int R = matrix.length, C = matrix[0].length;
+ boolean[][] seen = new boolean[R][C];
+ int[] dr = { 0, 1, 0, -1 };
+ int[] dc = { 1, 0, -1, 0 };
+ int r = 0, c = 0, di = 0;
+
+ // Iterate from 0 to R * C - 1
+ for (int i = 0; i < R * C; i++) {
+ ans.add(matrix[r]);
+ seen[r] = true;
+ int cr = r + dr[di];
+ int cc = c + dc[di];
+
+ if (0 <= cr && cr < R && 0 <= cc && cc < C
+ && !seen[cr][cc]) {
+ r = cr;
+ c = cc;
+ }
+ else {
+ di = (di + 1) % 4;
+ r += dr[di];
+ c += dc[di];
+ }
+ }
+ return ans;
+ }
+
+ // Driver Code
+ public static void main(String[] args)
+ {
+ int a[][] = { { 1, 2, 3, 4 },
+ { 5, 6, 7, 8 },
+ { 9, 10, 11, 12 },
+ { 13, 14, 15, 16 } };
+
+ System.out.println(spiralOrder(a));
+ }
+}
diff --git a/StackSorting.java b/StackSorting.java
new file mode 100644
index 0000000..49216f2
--- /dev/null
+++ b/StackSorting.java
@@ -0,0 +1,70 @@
+//This code sorts the Stack in such a way that greatest element is at the top of the stack
+
+/** Problem : Sort the Stack elements such that the greatest element is at the top of the stack
+ * Author : https://github.com/skmodi649
+ */
+
+
+
+import java.util.Scanner;
+import java.util.Stack;
+
+class StackSorting{
+ public static void main(String[] args){
+ Scanner sc=new Scanner(System.in);
+ System.out.println("Enter the Stack size : ");
+ Stack s=new Stack<>();
+ int n=sc.nextInt();
+ System.out.println("Enter the elements in the Stack : ");
+ while(n-->0)
+ s.push(sc.nextInt());
+ StackSorting g = new StackSorting();
+ System.out.println("Sorted Stack : ");
+ Stack a = g.sort(s); //Sorted elements inserted in new Stack
+ while (!a.empty()) {
+ System.out.print(a.peek() + " ");
+ a.pop();
+ }
+}
+
+ public void sortedInsert(Stack S , int element) // This method inserts the sorted element
+ {
+ if((S.empty()) || (S.peek() < element))
+ S.push(element);
+ else
+ {
+ int temp = S.pop();
+ sortedInsert(S , element);
+ S.push(temp);
+ }
+ }
+ public Stack sort(Stack s) //Sorts the stack and then returns it
+ {
+ if(!s.empty())
+ {
+ int temp = s.pop();
+ sort(s);
+ sortedInsert(s , temp);
+ }
+ return s;
+ }
+}
+
+
+
+/** Expected Time Complexity: O(N*N)
+ * Expected Auxiliary Space Complexity : O(N)
+ * Constraints : 1<=N<=100
+ */
+
+
+/** Test Case 1 :
+ * Enter the Stack size : 5
+ * Enter the elements in the Stack : 0 1 2 3 9
+ * Sorted Stack : 9 3 2 1 0
+ *
+ * Test Case 2 :
+ * Enter the Stack size : 6
+ * Enter the elements in the Stack : 3 1 2 9 8 7
+ * Sorted Stack : 9 8 7 3 2 1
+ */
\ No newline at end of file
diff --git a/String to LowerCase.java b/String to LowerCase.java
new file mode 100644
index 0000000..31652f5
--- /dev/null
+++ b/String to LowerCase.java
@@ -0,0 +1,32 @@
+// Initial template for Java
+
+import java.util.*;
+import java.io.*;
+
+class GFG {
+ public static void main(String args[]) throws IOException {
+ BufferedReader read =
+ new BufferedReader(new InputStreamReader(System.in));
+ System.out.println("Enter no of words you want to check");
+ int t = Integer.parseInt(read.readLine());
+
+ while (t-- > 0) {
+ System.out.println("Enter Word to conver to lowercase");
+ String S = read.readLine();
+ Solution ob = new Solution();
+
+ System.out.println(ob.toLower(S));
+ }
+ }
+}// } Driver Code Ends
+
+
+// User function template for Java
+
+class Solution {
+ static String toLower(String S) {
+ String S1=S.toLowerCase();
+ return S1;
+ }
+
+}
\ No newline at end of file
diff --git a/Structure_.class b/Structure_.class
new file mode 100644
index 0000000..3d3b666
Binary files /dev/null and b/Structure_.class differ
diff --git a/Subarrays.cpp b/Subarrays.cpp
new file mode 100644
index 0000000..c866e85
--- /dev/null
+++ b/Subarrays.cpp
@@ -0,0 +1,76 @@
+/*C++ program to find total number of
+even-odd subarrays present in given array*/
+#include
+using namespace std;
+
+// function that returns the count of subarrays that
+// contain equal number of odd as well as even numbers
+int countSubarrays(int arr[], int n)
+{
+ // initialize difference and answer with 0
+ int difference = 0;
+ int ans = 0;
+
+ // create two auxiliary hash arrays to count frequency
+ // of difference, one array for non-negative difference
+ // and other array for negative difference. Size of these
+ // two auxiliary arrays is 'n+1' because difference can
+ // reach maximum value 'n' as well as minimum value '-n'
+ int hash_positive[n + 1], hash_negative[n + 1];
+
+ // initialize these auxiliary arrays with 0
+ fill_n(hash_positive, n + 1, 0);
+ fill_n(hash_negative, n + 1, 0);
+
+ // since the difference is initially 0, we have to
+ // initialize hash_positive[0] with 1
+ hash_positive[0] = 1;
+
+ // for loop to iterate through whole
+ // array (zero-based indexing is used)
+ for (int i = 0; i < n ; i++)
+ {
+ // incrementing or decrementing difference based on
+ // arr[i] being even or odd, check if arr[i] is odd
+ if (arr[i] & 1 == 1)
+ difference++;
+ else
+ difference--;
+
+ // adding hash value of 'difference' to our answer
+ // as all the previous occurrences of the same
+ // difference value will make even-odd subarray
+ // ending at index 'i'. After that, we will increment
+ // hash array for that 'difference' value for
+ // its occurrence at index 'i'. if difference is
+ // negative then use hash_negative
+ if (difference < 0)
+ {
+ ans += hash_negative[-difference];
+ hash_negative[-difference]++;
+ }
+
+ // else use hash_positive
+ else
+ {
+ ans += hash_positive[difference];
+ hash_positive[difference]++;
+ }
+ }
+
+ // return total number of even-odd subarrays
+ return ans;
+}
+
+// Driver code
+int main()
+{
+ int arr[] = {3, 4, 6, 8, 1, 10, 5, 7};
+ int n = sizeof(arr) / sizeof(arr[0]);
+
+ // Printing total number of even-odd subarrays
+ cout << "Total Number of Even-Odd subarrays"
+ " are " << countSubarrays(arr,n);
+
+ return 0;
+}
diff --git a/TCPClient.java b/TCPClient.java
new file mode 100644
index 0000000..b3937d6
--- /dev/null
+++ b/TCPClient.java
@@ -0,0 +1,23 @@
+import java.io.*;
+import java.net.*;
+
+class TCPClient {
+ public static void main(String argv[]) throws Exception
+ {
+ String sentence;
+ String modifiedSentence;
+
+ BufferedReader inFromUser =new BufferedReader(new InputStreamReader(System.in));
+
+ Socket clientSocket = new Socket("localhost", 4444);
+
+ DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream());
+ BufferedReader inFromServer = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
+ System.out.println("Enter a message:");
+ sentence = inFromUser.readLine();
+ outToServer.writeBytes(sentence + '\n');
+ modifiedSentence = inFromServer.readLine();
+ System.out.println("FROM SERVER: " + modifiedSentence);
+ clientSocket.close();
+ }
+}
diff --git a/TCPServer.java b/TCPServer.java
new file mode 100644
index 0000000..2459778
--- /dev/null
+++ b/TCPServer.java
@@ -0,0 +1,42 @@
+import java.io.*;
+import java.net.*;
+class Thr extends Thread
+{
+ Socket s;
+
+ Thr(){s=null; }
+
+ Thr(Socket s1) { s=s1;}
+
+ public void run()
+ {
+ String clientSentence;
+ String capitalizedSentence;
+ try{
+ BufferedReader inFromClient =new BufferedReader(new InputStreamReader(s.getInputStream()));
+ DataOutputStream outToClient=new DataOutputStream(s.getOutputStream());
+ clientSentence = inFromClient.readLine();
+ System.out.println(clientSentence);
+ capitalizedSentence = clientSentence.toUpperCase() + '\n';
+ outToClient.writeBytes(capitalizedSentence);
+ s.close();
+ if(clientSentence.equals("exit"))
+ System.exit(1);
+
+ }
+ catch(Exception e){}
+ }
+
+ }
+ class TCPServer {
+ public static void main(String argv[]) throws Exception {
+
+ ServerSocket dataReceive = new ServerSocket(4444);
+
+ while(true) {
+ Socket connectionSocket = dataReceive.accept();
+ Thr t=new Thr(connectionSocket);
+ t.start();
+ }
+ }
+}
\ No newline at end of file
diff --git a/TopologicalSorting.java b/TopologicalSorting.java
new file mode 100644
index 0000000..ec85870
--- /dev/null
+++ b/TopologicalSorting.java
@@ -0,0 +1,53 @@
+import java.util.*;
+class Graph{
+ int v;
+ LinkedList adj[];
+ @SuppressWarnings("unchecked")
+ Graph(int v){
+ this.v=v;
+ adj=new LinkedList[v];
+ for(int i=0;i();
+ }
+}
+class TopologicalSorting{
+ public static void addEdge(Graph g,int u,int v){
+ g.adj[u].add(v);
+ }
+ public static void toposortutil(Graph g,int node,boolean visit[],Stack st)
+ {
+ visit[node]=true;
+ int i;
+ Iteratorit=g.adj[node].iterator();
+ while(it.hasNext())
+ {
+ i=it.next();
+ System.out.println(i);
+ if(!visit[i])
+ toposortutil(g,i,visit,st);
+ }
+ System.out.println("node"+node);
+ st.push(node);
+ }
+ public static void toposort(Graph g){
+ Stack st=new Stack();
+ boolean visit[]=new boolean[g.v];
+ for(int i=0;i [m[1;32mnew-branch[m[33m)[m
+Author: itsEobard2025
+Date: Sun Oct 31 09:48:15 2021 +0530
+
+ Added a new haiku in poetry.md file
+
+[33mcommit 9c663b4be4581f3c02c4a68dc20c44d493b2df65[m[33m ([m[1;31morigin/main[m[33m, [m[1;31morigin/HEAD[m[33m, [m[1;32mmain[m[33m)[m
+Merge: ffb996d 878130b
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sat Oct 30 16:30:56 2021 +0530
+
+ Merge pull request #109 from Assassin-compiler/main
+
+ Create CircularLinkedlist.cpp
+
+[33mcommit 878130bccdc35d6549fa73dea2f2a1deb891f4b2[m
+Author: Assassin-compiler <70448612+Assassin-compiler@users.noreply.github.com>
+Date: Sat Oct 30 16:29:15 2021 +0530
+
+ Create CircularLinkedlist.cpp
+
+[33mcommit ffb996d0d465df6275b1bb9e2279ed954ef2e01a[m
+Merge: 511fcd9 6be6ee7
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sat Oct 30 12:23:03 2021 +0530
+
+ Merge pull request #108 from Assassin-compiler/main
+
+ Create Subarrays.cpp
+
+[33mcommit 6be6ee7cb936fb2d7a1be3636f7e2b31583e3cb5[m
+Author: Assassin-compiler <70448612+Assassin-compiler@users.noreply.github.com>
+Date: Sat Oct 30 12:22:03 2021 +0530
+
+ Create Subarrays.cpp
+
+[33mcommit 511fcd9e697955621b65b8a7e695c6156866fa9d[m
+Merge: a589f14 6a00544
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sat Oct 30 12:16:11 2021 +0530
+
+ Merge pull request #107 from Assassin-compiler/main
+
+ Create range.cpp
+
+[33mcommit 6a00544099f04f160fd08bc62ab3f44446bead32[m
+Author: Assassin-compiler <70448612+Assassin-compiler@users.noreply.github.com>
+Date: Sat Oct 30 12:15:14 2021 +0530
+
+ Create range.cpp
+
+[33mcommit a589f14669a4d5b7a495e9c84be563dbe9a25242[m
+Merge: bfe9e75 83bed70
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sat Oct 30 12:13:38 2021 +0530
+
+ Merge pull request #106 from Assassin-compiler/main
+
+ Create triplets.cpp
+
+[33mcommit 83bed704d970691e6d3a3b646d004e0a5a64eac2[m
+Author: Assassin-compiler <70448612+Assassin-compiler@users.noreply.github.com>
+Date: Sat Oct 30 12:12:21 2021 +0530
+
+ Create triplets.cpp
+
+[33mcommit bfe9e757f9373c1aa635f39ee0a51816e3213349[m
+Merge: 23534ff f8a975a
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sat Oct 30 03:07:26 2021 +0530
+
+ Merge pull request #105 from PandaWire/main
+
+ Create PalindromicNumber.java
+
+[33mcommit 23534ff0374796be783ac08599447ae4f242f7cb[m
+Merge: 34483e9 473c349
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sat Oct 30 03:07:03 2021 +0530
+
+ Merge pull request #104 from rajniarora26/patch-3
+
+ Add PrimsAlgo.java
+
+[33mcommit f8a975a858c47ebbe9f7cceff1cc54b9145066d0[m
+Author: Andrew Pai <88261387+PandaWire@users.noreply.github.com>
+Date: Fri Oct 29 13:38:25 2021 -0700
+
+ Create PalindromicNumber.java
+
+[33mcommit 473c3499d6cde3f024c0e734d17c9fa8b092e85e[m
+Author: rajniarora26 <72189047+rajniarora26@users.noreply.github.com>
+Date: Sat Oct 30 00:43:01 2021 +0530
+
+ Add PrimsAlgo.java
+
+ Program for Prim's Algorithm
+
+[33mcommit 34483e957905d2a019c24eb41e2142ae611107a2[m
+Merge: e8f7b40 7a0f2dc
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Fri Oct 29 23:47:20 2021 +0530
+
+ Merge pull request #103 from madhav1928/main
+
+ Add files via upload
+
+[33mcommit e8f7b4026d4e34237aad7547c41a3f494c54524f[m
+Merge: 74e2b76 866c836
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Fri Oct 29 23:47:00 2021 +0530
+
+ Merge pull request #102 from rajniarora26/patch-1
+
+ Add BottomView.java
+
+[33mcommit 74e2b76d2d5312b4fbc533a23f85ed109dbadff2[m
+Merge: bab03be ef5cc63
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Fri Oct 29 23:46:36 2021 +0530
+
+ Merge pull request #101 from Anuragjain20/arj
+
+ added diamond pattern program
+
+[33mcommit 7a0f2dc6cd68685a02c852b38ce96ce9faf9a0d5[m
+Author: Madhav <56249178+madhav1928@users.noreply.github.com>
+Date: Fri Oct 29 23:29:21 2021 +0530
+
+ Add files via upload
+
+[33mcommit 866c836c2953e741cdea622dbba2111401ebc229[m
+Author: rajniarora26 <72189047+rajniarora26@users.noreply.github.com>
+Date: Fri Oct 29 22:05:14 2021 +0530
+
+ Add BottomView.java
+
+ Program to print bottom view of a binary tree.
+
+[33mcommit ef5cc639b6f2fc7d63a2dba8d20f3fba1f454db7[m
+Author: Anurag
+Date: Fri Oct 29 21:40:22 2021 +0530
+
+ added diamond pattern program
+
+[33mcommit bab03be437a57295cd8783042c83b39b64929e1d[m
+Merge: 281731e 3b451f1
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Fri Oct 29 12:44:27 2021 +0530
+
+ Merge pull request #100 from lkmSasanga/main
+
+ search an element in a Circular Linked List
+
+[33mcommit 281731ed1f792c92db12302a73151ebe1bcc500e[m
+Merge: 7ab36d3 a49ba75
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Fri Oct 29 12:44:04 2021 +0530
+
+ Merge pull request #99 from neetukhanna11/patch-1
+
+ Committing BinaryTree.java
+
+[33mcommit 3b451f1f026658d30d29e76049ba51f63826ed72[m
+Author: Malindu Sasanga
+Date: Fri Oct 29 12:35:06 2021 +0530
+
+ search an element in a Circular Linked List
+
+ Java program to search an element in a Circular Linked List
+
+[33mcommit a49ba759096e0f892ff8769861f6cf51ef21d341[m
+Author: neetukhanna11 <72187682+neetukhanna11@users.noreply.github.com>
+Date: Fri Oct 29 10:32:03 2021 +0530
+
+ Committing BinaryTree.java
+
+ Program to print Top View of a Binary Tree
+
+[33mcommit 7ab36d332e5abc2a7c75255449cc44cace31fc51[m
+Merge: 2dbd83c f995a04
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Fri Oct 29 01:50:57 2021 +0530
+
+ Merge pull request #98 from jhanna60/main
+
+ Adding a heapsort algorithm
+
+[33mcommit f995a04241410e1a5e72289700ec5aa6b2e4420a[m
+Author: john hanna
+Date: Thu Oct 28 19:07:34 2021 +0100
+
+ Adding a heapsort algorithm
+
+[33mcommit 2dbd83c8470f8761e373d96cda28747ad286fef3[m
+Merge: a0a0d34 acfbaad
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Thu Oct 28 23:26:17 2021 +0530
+
+ Merge pull request #95 from Nehansh10/dev
+
+ Last Digit of Fibonnaci
+
+[33mcommit a0a0d34200e7300839f2854bf2d20d3cb31ec92c[m
+Merge: e40589c 56aa950
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Thu Oct 28 23:25:55 2021 +0530
+
+ Merge pull request #96 from eby8zevin/patch-1
+
+ Create Searching.java
+
+[33mcommit e40589cd2a6acd38eb5675c0493eb5cdc3b27e4c[m
+Merge: 540e2da 5b61e7f
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Thu Oct 28 23:25:25 2021 +0530
+
+ Merge pull request #97 from vanditkhurana1/patch-1
+
+ Committing SpiralMatrix.java
+
+[33mcommit 5b61e7fce61e8d50ad58ef04f36ba48cd6a7af5a[m
+Author: vanditkhurana1 <92248205+vanditkhurana1@users.noreply.github.com>
+Date: Thu Oct 28 21:24:33 2021 +0530
+
+ Committing SpiralMatrix.java
+
+[33mcommit 56aa9502992c6897a279d3ee9a627a7e07070f07[m
+Author: احمد ابو حسن <36786100+eby8zevin@users.noreply.github.com>
+Date: Thu Oct 28 22:33:34 2021 +0700
+
+ Create Searching.java
+
+[33mcommit acfbaada5d4dc415623a106dbba22cec8099dfd6[m
+Author: Nehansh10
+Date: Thu Oct 28 20:55:21 2021 +0530
+
+ Last Digit of Fibonnaci
+
+[33mcommit 540e2dabbbfb2eae37b5603abd737dc73e686693[m
+Merge: 9fbc959 e97cdb2
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Thu Oct 28 20:41:20 2021 +0530
+
+ Merge pull request #94 from eby8zevin/main
+
+ Create Calculator.java
+
+[33mcommit 9fbc9594a7873b1e1d4e2f8c54dd6f89c85397d1[m
+Merge: ddc8a74 08f6b22
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Thu Oct 28 20:40:56 2021 +0530
+
+ Merge pull request #93 from harshalkh/patch-1
+
+ Create BucketSort.java
+
+[33mcommit e97cdb2be169f89d4a8d970b1b692f2a7cd80f71[m
+Author: احمد ابو حسن <36786100+eby8zevin@users.noreply.github.com>
+Date: Thu Oct 28 22:02:38 2021 +0700
+
+ Create Calculator.java
+
+[33mcommit 08f6b22411857448fde28f89e37666944234f2de[m
+Author: Harshal <37841724+harshalkh@users.noreply.github.com>
+Date: Thu Oct 28 19:49:44 2021 +0530
+
+ Create BucketSort.java
+
+ Bucket sort in java
+
+[33mcommit ddc8a74563b899e7f184d5209065ff16c87022a6[m
+Merge: 106167e 4ec4a02
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Thu Oct 28 18:35:31 2021 +0530
+
+ Merge pull request #92 from gandharva-gk/main
+
+ Binary Search
+
+[33mcommit 4ec4a024456e16dcaa08404576f852bba6caa60f[m
+Author: gandharva
+Date: Thu Oct 28 18:30:36 2021 +0530
+
+ Binary Search
+
+[33mcommit 106167eb722f4ca832d3e0a660ddc2aff875818d[m
+Merge: ba394c0 58a2cc4
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Thu Oct 28 18:01:21 2021 +0530
+
+ Merge pull request #91 from gandharva-gk/main
+
+ Merge Two Sorted Lists
+
+[33mcommit 58a2cc462c2158090ae475013f7ee3b736668a13[m
+Author: gandharva
+Date: Thu Oct 28 17:36:39 2021 +0530
+
+ Merge Two Sorted Lists
+
+[33mcommit ba394c09842a23e8214dd7bf7003018faf363127[m
+Merge: 0adf103 5ae4bc9
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Thu Oct 28 13:30:04 2021 +0530
+
+ Merge pull request #90 from andikscript/main
+
+ add data structure graphs FloydWarshall
+
+[33mcommit 5ae4bc9e8e66decbeb3b1d88b89d89868d7a6574[m
+Author: andikscript
+Date: Thu Oct 28 13:51:26 2021 +0700
+
+ add data structure graphs FloydWarshall
+
+[33mcommit 0adf103da1120faac8c3b8bbe1aab2d08f614a26[m
+Merge: f25a5c6 1e745d3
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Thu Oct 28 12:12:32 2021 +0530
+
+ Merge pull request #89 from andikscript/main
+
+ add algorithm cipher RSA
+
+[33mcommit 1e745d34732e0bd4f9301de76136dd20f2edbebe[m
+Author: andikscript
+Date: Thu Oct 28 13:32:55 2021 +0700
+
+ add algorithm cipher RSA
+
+[33mcommit f25a5c673ee2f30be441fa8e47c9cc1ee32827ee[m
+Merge: 1949140 06d7e06
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Thu Oct 28 11:49:42 2021 +0530
+
+ Merge pull request #88 from dayagct/main
+
+ Catalan number upload
+
+[33mcommit 1949140dd3e7dac65d144c9affc70e32a30bb05c[m
+Merge: 91d8380 02405ee
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Thu Oct 28 11:48:48 2021 +0530
+
+ Merge pull request #87 from andikscript/main
+
+ add algorithm radix sort
+
+[33mcommit 91d8380718ef2e9ab5658e98bb5c0d5756dca035[m
+Merge: 9614a19 6cd486e
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Thu Oct 28 11:43:01 2021 +0530
+
+ Merge pull request #86 from ShreyasAnish/main
+
+ Create TrafficLight.java
+
+[33mcommit 9614a19d736c6e870a35ab8350d48fbfa774b935[m
+Merge: 673b959 081b3ed
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Thu Oct 28 11:42:36 2021 +0530
+
+ Merge pull request #85 from SahanChan/main
+
+ hacktoberfest2021SahanChan
+
+[33mcommit 673b9595bcd1d3fb347b53c1a7a4753d827fddec[m
+Merge: 712e924 050a5c1
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Thu Oct 28 11:42:08 2021 +0530
+
+ Merge pull request #84 from vanditkhurana/patch-1
+
+ Committing KadanesAlgo.java
+
+[33mcommit 06d7e0636b0e5985b2c0d0f5ee1417806d4630e8[m
+Author: dayagct <91879871+dayagct@users.noreply.github.com>
+Date: Thu Oct 28 09:19:09 2021 +0530
+
+ Add files via upload
+
+ Added Java program for Catalan numbers
+
+[33mcommit 02405eee192c84befc28c6da082df21e4e514c5d[m
+Author: andikscript
+Date: Thu Oct 28 07:22:21 2021 +0700
+
+ add algorithm radix sort
+
+[33mcommit 6cd486ecdc49c18f9548106882ab88b8c5ebd755[m
+Author: ShreyasAnish <65059923+ShreyasAnish@users.noreply.github.com>
+Date: Thu Oct 28 01:33:14 2021 +0530
+
+ Create TrafficLight.java
+
+ A program to simulate the red, yellow and green lights in a traffic signal using Java Swing.
+
+[33mcommit 081b3ed7f99026a81dbbc3ab12b215dacc2dced0[m
+Author: Sahan Chan
+Date: Wed Oct 27 23:02:45 2021 +0530
+
+ hacktoberfest2021SahanChan
+
+[33mcommit 050a5c1d6d6ce0304ab40aaf395f9f8eff6a0514[m
+Author: Vandit <52314194+vanditkhurana@users.noreply.github.com>
+Date: Wed Oct 27 23:02:19 2021 +0530
+
+ Committing KadanesAlgo.java
+
+[33mcommit 712e92496fba3aa71a8f04e45b350d172e2beec5[m
+Merge: 4c27349 e79ed8d
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Wed Oct 27 22:52:18 2021 +0530
+
+ Merge pull request #82 from shubhamSM1298/main
+
+ Circular Queue
+
+[33mcommit 4c27349c1a3f5bd2132bc7de5a90e1d69b1a171e[m
+Merge: 639143e 70fc510
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Wed Oct 27 22:51:55 2021 +0530
+
+ Merge pull request #83 from prateekgargX/main
+
+ RSA Algorithm in JAVA
+
+[33mcommit 70fc5109353852bc7894877391f9f7f24347be1e[m
+Author: prateekgargX
+Date: Wed Oct 27 20:14:41 2021 +0530
+
+ RSA Algorithm in JAVA
+
+[33mcommit e79ed8d527c8f7ef49abbc62ede882ae00fbb28d[m
+Author: Shubham Mallya <91719093+shubhamSM1298@users.noreply.github.com>
+Date: Tue Oct 26 11:20:36 2021 +0530
+
+ Circular Queue
+
+ pls check it
+
+[33mcommit 639143e2cde653d4dca67b9c98f47949e29c73a3[m
+Merge: 2ef0b76 63b92ff
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Tue Oct 26 11:19:16 2021 +0530
+
+ Merge pull request #81 from AdityaRawat07/main
+
+ Buzz.java
+
+[33mcommit 2ef0b76ac184d4128d2731e98eeb33358b254c31[m
+Merge: 0e66ad7 4e40329
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Tue Oct 26 11:18:57 2021 +0530
+
+ Merge pull request #80 from rnzit/patch-1
+
+ Create ReverseString.java
+
+[33mcommit 0e66ad7c39d6e69f202924b50a5a6357807660c6[m
+Merge: 4c18ea4 ef7bb7a
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Tue Oct 26 11:18:41 2021 +0530
+
+ Merge pull request #79 from ana-pat/patch-1
+
+ Kasturba.java
+
+[33mcommit 4c18ea415e87ee1f3b4653b8e86ee0849ca78f38[m
+Merge: 1ccc528 6d46cb9
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Tue Oct 26 11:18:00 2021 +0530
+
+ Merge pull request #78 from sahooankeeta/main
+
+ added k equal sum subsets
+
+[33mcommit 1ccc528a378b46d5b52b3ab6f9900f4153a403ab[m
+Merge: 9379b5a 0c0e1e3
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Tue Oct 26 11:17:35 2021 +0530
+
+ Merge pull request #77 from sanju2/main
+
+ BogoSort.java Added
+
+[33mcommit 9379b5a67970609ef028cffc70494f936caad014[m
+Merge: 0ce32fd fe2f9ad
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Tue Oct 26 11:16:54 2021 +0530
+
+ Merge pull request #76 from anjupriya-v/main
+
+ Anagram
+
+[33mcommit 0ce32fd97375a45297fa02ad07a5ef2f49c9b05e[m
+Merge: ca35182 7b2def2
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Tue Oct 26 11:16:23 2021 +0530
+
+ Merge pull request #75 from Sachin-Liyanage/main
+
+ Program for Tower of Hanoi
+
+[33mcommit ca35182cba403921f69c173839a169beff0cefe4[m
+Merge: 980a238 7af3552
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Tue Oct 26 11:16:03 2021 +0530
+
+ Merge pull request #74 from krittin1/main
+
+ :sparkles: [feat]: add GuessingGame program
+
+[33mcommit 980a238f4f8145c48ee65d30fb7df6b77ab10e24[m
+Merge: 6b72837 4dde16c
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Tue Oct 26 11:15:35 2021 +0530
+
+ Merge pull request #73 from Yasas4D/main-oop-concepts
+
+ Add main OOP concepts
+
+[33mcommit 6b72837b5114d88625e86c0e063155c5a32a1e24[m
+Merge: d9b8924 be8b463
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Tue Oct 26 11:14:45 2021 +0530
+
+ Merge pull request #72 from adithyarjndrn/main
+
+ DECimal2Hexa
+
+[33mcommit 63b92ffe6aedaaf7e9aba6f0092f7ae64862b506[m
+Author: AdityaRawat07 <92925758+AdityaRawat07@users.noreply.github.com>
+Date: Mon Oct 25 22:25:38 2021 +0530
+
+ Buzz.java
+
+[33mcommit 4e40329c43407238d168412fc89e2cb277350889[m
+Author: rnzit <32677893+rnzit@users.noreply.github.com>
+Date: Mon Oct 25 22:48:06 2021 +0700
+
+ Create ReverseString.java
+
+[33mcommit ef7bb7ac86d3dfc89f6ddb7b5df0e8f10a89c0a2[m
+Author: Ananya Pathak <54628162+ana-pat@users.noreply.github.com>
+Date: Mon Oct 25 14:21:02 2021 +0530
+
+ Kasturba.java
+
+ Implements Kasturba Algorithm for Matrix Multiplication
+
+[33mcommit 6d46cb9dd743859248e55379860f7fc712bea788[m
+Author: Ankeeta Sahoo
+Date: Sun Oct 24 21:59:22 2021 +0530
+
+ added k equal sum subset
+
+[33mcommit 0c0e1e337a62d2210aa54cc4f5cb7cd1422cbe6d[m
+Author: lasantha96
+Date: Sun Oct 24 21:54:09 2021 +0530
+
+ BogoSort.java Added
+
+[33mcommit f86c8b588ce1bfb44e21aaba7179b337b900b48b[m
+Author: Ankeeta Sahoo
+Date: Sun Oct 24 21:49:02 2021 +0530
+
+ added k equal sum subsets
+
+[33mcommit fe2f9ad0186185d82d4e4707040722ce180ffd03[m
+Author: Anju Priya V <84177086+anjupriya-v@users.noreply.github.com>
+Date: Sun Oct 24 21:28:19 2021 +0530
+
+ Add files via upload
+
+[33mcommit 7b2def2196f913e33665ebbebf8acef850fbe152[m
+Author: Sachin Liyanage <59449070+Sachin-Liyanage@users.noreply.github.com>
+Date: Sun Oct 24 21:10:13 2021 +0530
+
+ Program for Tower of Hanoi
+
+[33mcommit 7af35521ddef4c929770bb10d2b14a8aeb0c0554[m
+Author: Arty Kanok
+Date: Sun Oct 24 18:15:23 2021 +0700
+
+ :sparkles: [feat]: add Hangman.java
+
+[33mcommit b676c29f699c3b387aa0de9ba50a6cb2b332b609[m
+Author: Arty Kanok
+Date: Sun Oct 24 18:08:53 2021 +0700
+
+ :sparkles: [feat]: add WordMatch.java
+
+[33mcommit c7908ff590c59293e73e7b1a8de675284e7ab816[m
+Author: Arty Kanok
+Date: Sun Oct 24 18:07:42 2021 +0700
+
+ :sparkles: [feat]: add GuessingGame program
+
+[33mcommit 4dde16c31025ff6127a100f9e2d22fc22412154a[m
+Author: Yasas Sandeepa
+Date: Sun Oct 24 12:39:37 2021 +0530
+
+ Add main OOP concepts
+
+[33mcommit be8b4635890f16e7ef26156fa1dcc107d8d1ed58[m
+Author: adithyarjndrn
+Date: Sun Oct 24 05:41:21 2021 +0530
+
+ DECimal2Hexa
+
+[33mcommit d9b892440d9388667634e43e866b6f374d9330ba[m
+Merge: e0d3cc0 fa97914
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Fri Oct 22 22:54:55 2021 +0530
+
+ Merge pull request #70 from gandharva-gk/main
+
+ Djikstra Algorithm in Java
+
+[33mcommit fa97914321137081345834ab75096986683b01c0[m
+Author: gandharva
+Date: Fri Oct 22 19:12:27 2021 +0530
+
+ Djikstra Algorithm in Java
+
+[33mcommit e0d3cc02ac6409c2dfb226e701bb24ab57094a3a[m
+Merge: 0f2f250 a2208d4
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Thu Oct 21 20:16:57 2021 +0530
+
+ Merge pull request #69 from DushyanthaAT/main
+
+ Fibonacci.java
+
+[33mcommit a2208d4c3f23daebc19596278991e7a2d281fdd9[m
+Author: Dushyantha Thilakarathne
+Date: Thu Oct 21 17:07:45 2021 +0530
+
+ Fibonacci.java
+
+ Updated this code to get user input and print Fibonacci series
+
+[33mcommit 0f2f25004b029d5144f7e44d87f2c55fa96ea331[m
+Merge: d3a9ff9 cd0d89f
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Thu Oct 21 08:23:13 2021 +0530
+
+ Merge pull request #68 from Amrutha26/main
+
+ added java file
+
+[33mcommit cd0d89f3bf0bfc5b43c1c88cf9cb2d217e53e8e0[m
+Author: Amrutha <62595123+Amrutha26@users.noreply.github.com>
+Date: Thu Oct 21 04:51:41 2021 +0530
+
+ added java file
+
+[33mcommit d3a9ff972ef4aa4d9f9a30243ca5eda1482758f2[m
+Merge: 89c336d f1d9371
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Wed Oct 20 22:31:54 2021 +0530
+
+ Merge pull request #66 from DushyanthaAT/main
+
+ ReverseArray.java
+
+[33mcommit 89c336da7a484a5bbc64fcf1d703fc2a97920f08[m
+Merge: bda2033 45ac778
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Wed Oct 20 22:30:50 2021 +0530
+
+ Merge pull request #67 from Amrutha26/main
+
+ added java file
+
+[33mcommit 45ac778db38eb9a6fcbd852b8f32bbcc1685e610[m
+Author: Amrutha <62595123+Amrutha26@users.noreply.github.com>
+Date: Wed Oct 20 18:55:35 2021 +0530
+
+ added java file
+
+[33mcommit f1d9371e820d2cf42535b65aa112cb3f5d4d5fa1[m
+Author: Dushyantha Thilakarathne
+Date: Wed Oct 20 13:55:11 2021 +0530
+
+ ReverseArray.java
+
+ I have updated this code for saving the reversed array.
+
+[33mcommit bda2033ec2f8818d71e0279add11c63e3f22f27d[m
+Merge: c2b980b f0a25ff
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Wed Oct 20 12:57:16 2021 +0530
+
+ Merge pull request #60 from skmodi649/Add-StackSorting.java
+
+ Create StackSorting.java
+
+[33mcommit c2b980bea6ba65759ecd5b43631d2063f9fa8c27[m
+Merge: 3547cdb 7e7bf5e
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Wed Oct 20 12:56:44 2021 +0530
+
+ Merge pull request #61 from skmodi649/Add-DigitalRoot.java
+
+ Create DigitalRoot.java
+
+[33mcommit 3547cdb0a35c1d7d797dc5094cc5c8edca68bed5[m
+Merge: 8a8b10f b30afe1
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Wed Oct 20 12:56:25 2021 +0530
+
+ Merge pull request #62 from kashishahuja2002/Kashish
+
+ KBC quiz
+
+[33mcommit 8a8b10f8f70c294ac67e2d974db91871fc1b9897[m
+Merge: 492e182 ddb9efa
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Wed Oct 20 12:56:04 2021 +0530
+
+ Merge pull request #63 from Amrutha26/main
+
+ Rotated Binary Search
+
+[33mcommit 492e182c8db10f383b51da215a2916896ea80433[m
+Merge: 27e2a03 538851e
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Wed Oct 20 12:55:44 2021 +0530
+
+ Merge pull request #65 from DiSousaDev/java_readme
+
+ Java readme
+
+[33mcommit 538851e1cb306419319f92f40dc6a8d0e0497de8[m
+Author: Eder Diego de Sousa
+Date: Tue Oct 19 14:51:39 2021 -0300
+
+ Add readme
+
+[33mcommit 063b9da1a8af8b23785356f5d4017f932159a0e0[m
+Author: Eder Diego de Sousa
+Date: Tue Oct 19 14:35:51 2021 -0300
+
+ Add an ArrayListString example
+
+[33mcommit ddb9efaf474dc5b1708db2b1a68f5c32671f9b3a[m
+Author: Amrutha <62595123+Amrutha26@users.noreply.github.com>
+Date: Mon Oct 18 18:46:23 2021 +0530
+
+ added java file
+
+[33mcommit 0ed87b0ab70fabbe9ac22303520677a183ca6022[m
+Author: Amrutha <62595123+Amrutha26@users.noreply.github.com>
+Date: Mon Oct 18 18:40:10 2021 +0530
+
+ added java file
+
+[33mcommit b30afe1db92c262c20abe0e150801789f33ff563[m
+Author: Kashish Ahuja
+Date: Mon Oct 18 18:10:13 2021 +0530
+
+ KBC quiz
+
+[33mcommit 7e7bf5ea3ffae30c759c8741f135672c2c32d3d1[m
+Author: Suraj Kumar Modi <76468931+skmodi649@users.noreply.github.com>
+Date: Sun Oct 17 20:14:51 2021 +0530
+
+ Create DigitalRoot.java
+
+[33mcommit f0a25ff51e4444b2b305bee1d56c47522f10106a[m
+Author: Suraj Kumar Modi <76468931+skmodi649@users.noreply.github.com>
+Date: Sun Oct 17 20:03:18 2021 +0530
+
+ Create StackSorting.java
+
+[33mcommit 27e2a03a332d295b6c9f1c6c64793b6f4c2e5ae1[m
+Merge: 9d994cb 7486547
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 17 15:20:53 2021 +0530
+
+ Merge pull request #59 from runtime-error2905/main
+
+ Created Matrix Multiplication java file
+
+[33mcommit 74865471c35706ba881fbb228a498e52cff7a889[m
+Author: SAURABH KUMAR <86124127+runtime-error2905@users.noreply.github.com>
+Date: Sun Oct 17 15:14:14 2021 +0530
+
+ Created Matrix Multiplication java file
+
+ Implementation of Matrix Multiplication
+
+[33mcommit 9d994cb1183aaeae25aa39343fb2243ee76d47ab[m
+Merge: 6480868 ae90ff0
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 17 03:46:37 2021 +0530
+
+ Merge pull request #54 from vipu18/main
+
+ Create java_database_connectivity.java
+
+[33mcommit 64808683696d5407186d5481201d85484f28afc0[m
+Merge: d24f775 e7df62c
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 17 03:46:15 2021 +0530
+
+ Merge pull request #53 from krishnapalS/patch-2
+
+ Create BST.java
+
+[33mcommit d24f7759aaf1ef6670a4529fc6e4ce0eae551400[m
+Merge: 6353c4b 48c08c6
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 17 03:45:44 2021 +0530
+
+ Merge pull request #52 from khushi200701/pr2
+
+ climbing-stairs-leetcode
+
+[33mcommit 6353c4b0c4d007de86a599a5694d63613b614589[m
+Merge: 2418c57 a09f97c
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 17 03:45:17 2021 +0530
+
+ Merge pull request #51 from Priya-shan/main
+
+ Added 3 Programs - Breakdigit, ReverseArray, RandomNumberGenerator
+
+[33mcommit 2418c5794d11007ffe0006d755bdcf5f2ac7cf41[m
+Merge: af0ea0d 3f35faf
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 17 03:44:49 2021 +0530
+
+ Merge pull request #50 from nawodyaonline/main
+
+ ArrayList iteration ways
+
+[33mcommit af0ea0de41ecf6e839d19851833cc4eeae727cfe[m
+Merge: f0b6e7a 02f48ce
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 17 03:44:27 2021 +0530
+
+ Merge pull request #49 from AbhinandanAdhikari/Java-Factorial
+
+ JAVA Program to Calculate Factorial of a Number
+
+[33mcommit f0b6e7ad30dc0dfdab612d079639d92929cdb7e9[m
+Merge: 0c8c846 bc10764
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 17 03:43:59 2021 +0530
+
+ Merge pull request #48 from harsh827/main
+
+ Hash-Table-In-Java
+
+[33mcommit 0c8c8469f84c3783a6b51179912ef8762ac6be54[m
+Merge: e145051 2b25423
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 17 03:43:30 2021 +0530
+
+ Merge pull request #47 from hitesh181/main
+
+ Added java program to convert string to lower case
+
+[33mcommit e14505181431a5306dda9fa8cd25e9ff525c9d8b[m
+Merge: 3183266 2b5d76d
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 17 03:43:05 2021 +0530
+
+ Merge pull request #55 from JayNakum/main
+
+ Adding programs of JavaApplets
+
+[33mcommit 31832669b94b7e243abb8f31d24d49dd97ca0e9e[m
+Merge: 39b3342 bd7b643
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 17 03:42:35 2021 +0530
+
+ Merge pull request #56 from Omkar0114/main
+
+ Create sqrt.java
+
+[33mcommit 39b33423e913352cd4f8c7b5ff9cf870b8503611[m
+Merge: bd1743c 9db8388
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 17 03:42:05 2021 +0530
+
+ Merge pull request #57 from DasuniMaheshika/main
+
+ Create GreatestCommonDivisor.java
+
+[33mcommit 9db83887461410bbc7472218737e4ad2d02da8e6[m
+Author: Dasuni Udugama Sooriyage <58808249+DasuniMaheshika@users.noreply.github.com>
+Date: Fri Oct 15 22:59:45 2021 +0530
+
+ Create GreatestCommonDivisor.java
+
+ Finding Greatest Common Divisor using Java
+
+[33mcommit bd7b6431ed65dae507f0594d8f3621b3f51cb200[m
+Author: Omkar kulkarni <88308267+Omkar0114@users.noreply.github.com>
+Date: Fri Oct 15 17:49:39 2021 +0530
+
+ Create sqrt.java
+
+[33mcommit 2b5d76d44d4dc7c7fe2360c8e5f30be6db39889a[m
+Author: Jay Nakum
+Date: Fri Oct 15 16:46:24 2021 +0530
+
+ Added an example program of AWT Elements and behaviour
+
+[33mcommit b68f7d643b85b0d178a420c436cd4ffe2d5674d1[m
+Author: Jay Nakum
+Date: Thu Oct 14 09:50:42 2021 +0530
+
+ Added basic programs of JavaApplets
+
+[33mcommit ae90ff06e0133c65e2dc678fb9f1f464ae4cc6a8[m
+Author: Vipanshu Suman <73050057+vipu18@users.noreply.github.com>
+Date: Wed Oct 13 19:50:50 2021 +0530
+
+ Create java_database_connectivity.java
+
+[33mcommit bd1743cb567ef0b0821738cdf8bd5855d522ebdd[m
+Merge: 56f1568 4a640b0
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Wed Oct 13 10:02:47 2021 +0530
+
+ Merge pull request #46 from tushar152/main
+
+ Create amstrongNumber.java
+
+[33mcommit e7df62c19ef4611f77a138e20f961d4e0389c101[m
+Author: Krishna Pal Deora <47516664+krishnapalS@users.noreply.github.com>
+Date: Tue Oct 12 22:04:56 2021 +0530
+
+ Create BST.java
+
+[33mcommit 48c08c6f52cf167c750ad34ae8d2867d485a68d4[m
+Author: Khushi <58480229+khushi200701@users.noreply.github.com>
+Date: Tue Oct 12 11:08:16 2021 +0530
+
+ climbing-stairs-leetcode
+
+[33mcommit a09f97c10f05dea8560aca12f3c561163cbfe570[m
+Author: Shanmuga Priya M <67195594+Priya-shan@users.noreply.github.com>
+Date: Tue Oct 12 03:42:30 2021 +0530
+
+ Create ReverseArray.java
+
+[33mcommit 98c8bcc0c55bd055808e94150effa76e78e8cbef[m
+Author: Shanmuga Priya M <67195594+Priya-shan@users.noreply.github.com>
+Date: Tue Oct 12 03:41:39 2021 +0530
+
+ Create RandomNumber.java
+
+[33mcommit 0da1876a8228281be330440df8c223c16c85f33c[m
+Author: Shanmuga Priya M <67195594+Priya-shan@users.noreply.github.com>
+Date: Tue Oct 12 03:40:44 2021 +0530
+
+ Create BreakDigit.java
+
+[33mcommit 3f35fafae45d7b28ab6cbb999a59979b6386d633[m
+Author: Nawodya Jayalath
+Date: Mon Oct 11 22:02:46 2021 +0530
+
+ ArrayList iteration ways
+
+[33mcommit 02f48ce48f3d7421f35fcfc743eca2dcd334f98d[m
+Author: Abhinandan Adhikari
+Date: Mon Oct 11 21:46:38 2021 +0530
+
+ Added Java Program to find Factorial
+
+[33mcommit bc107643ecc60643596c7a7ce250cc22398bbe20[m
+Author: Harsh Kumar <73309402+harsh827@users.noreply.github.com>
+Date: Mon Oct 11 21:07:02 2021 +0530
+
+ Create knight__tour.java
+
+[33mcommit 989620e46ef9002044ebc70b312606248d05dea0[m
+Author: Harsh Kumar <73309402+harsh827@users.noreply.github.com>
+Date: Mon Oct 11 21:00:44 2021 +0530
+
+ Rename hash_table_implementation.java to hash_table_code.java
+
+[33mcommit 66cf8d914a4adaa25d0ded1980a8d95a250c7886[m
+Author: Harsh Kumar <73309402+harsh827@users.noreply.github.com>
+Date: Mon Oct 11 20:58:23 2021 +0530
+
+ Hash-Table-In-Java
+
+ Implementation of hash table in java
+
+[33mcommit 2b2542376046302d0bfbb5b448cdea526dbd47c3[m
+Author: Hitesh Sharma <68909492+hitesh181@users.noreply.github.com>
+Date: Sun Oct 10 00:25:07 2021 +0530
+
+ Added java program to convert string to lower case
+
+[33mcommit 4a640b018e3a66d5b91488c68055d576d4838b47[m
+Author: Tushar Garg <61476389+tushar152@users.noreply.github.com>
+Date: Sat Oct 9 02:45:45 2021 +0530
+
+ Update ShellSort.java
+
+[33mcommit e4fba59f8bb18b0068f7f05cf7d60cbc9eadca33[m
+Author: Tushar Garg <61476389+tushar152@users.noreply.github.com>
+Date: Sat Oct 9 02:43:27 2021 +0530
+
+ Update QuickSort.java
+
+[33mcommit 0f3bfc6479917a99c95beb9ae6c58f02b8eb4cba[m
+Author: Tushar Garg <61476389+tushar152@users.noreply.github.com>
+Date: Sat Oct 9 02:39:45 2021 +0530
+
+ Update Echo.java
+
+[33mcommit d2a0d1de9338084467a0f6432d78a56f9e579b64[m
+Author: Tushar Garg <61476389+tushar152@users.noreply.github.com>
+Date: Sat Oct 9 02:38:10 2021 +0530
+
+ Update Harry.java
+
+[33mcommit 90c990d416cb172c81abbe6a1f78364227504f39[m
+Author: Tushar Garg <61476389+tushar152@users.noreply.github.com>
+Date: Sat Oct 9 02:36:54 2021 +0530
+
+ Update Fibonacci.java
+
+[33mcommit d681b531664de96311acc8ec929290124e4dde0f[m
+Author: Tushar Garg <61476389+tushar152@users.noreply.github.com>
+Date: Sat Oct 9 02:32:49 2021 +0530
+
+ Update BubbleSort.java
+
+[33mcommit c4c33de312bc64624aa399a5055b0e1f1d0de292[m
+Author: Tushar Garg <61476389+tushar152@users.noreply.github.com>
+Date: Sat Oct 9 02:30:40 2021 +0530
+
+ Create armstrongNumber.java
+
+[33mcommit 56f1568082bc3a7cee1c1973b1669734c5232c20[m
+Merge: 272b0de 63076ca
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sat Oct 9 00:50:02 2021 +0530
+
+ Merge pull request #45 from hitesh181/main
+
+ Adding java program for Number Diamond pattern
+
+[33mcommit 63076cac6f70b6644f3bfeb83a727fec57d35acb[m
+Author: Hitesh Sharma <68909492+hitesh181@users.noreply.github.com>
+Date: Sat Oct 9 00:48:43 2021 +0530
+
+ Adding java program for Number Diamond pattern
+
+[33mcommit 272b0de7fe136935eff1c734c847bb50d00c67c0[m
+Merge: c3cbdc8 28f5a86
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Tue Oct 5 23:33:22 2021 +0530
+
+ Merge pull request #43 from AbhinandanAdhikari/java-prime
+
+ Java Program to Check whether the Number is Prime or Not.
+
+[33mcommit 28f5a867f76d741aa0f30cbf50c58b9ee8ab4d58[m
+Author: Abhinandan Adhikari
+Date: Tue Oct 5 21:37:10 2021 +0530
+
+ Java code for Prime Number
+
+[33mcommit c3cbdc81e7e8cdfe29026c62a0d2b3ad30d04672[m
+Merge: df90af7 d8eeed0
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Mon Oct 4 19:41:50 2021 +0530
+
+ Merge pull request #42 from Saurabh2509/main
+
+ Stack java
+
+[33mcommit df90af71ecf8ce34a11a1b80ab827b35c9264a4e[m
+Merge: 2deb06c d8ad866
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Mon Oct 4 19:41:31 2021 +0530
+
+ Merge pull request #41 from abhijeet49/main
+
+ Added MultiClassDemo.java file
+
+[33mcommit d8eeed0ce24ef7fc8e9981bf88ed84959326ce17[m
+Author: Saurabh Kumar <54509629+Saurabh2509@users.noreply.github.com>
+Date: Mon Oct 4 19:40:55 2021 +0530
+
+ Stack java
+
+ Implementation Stack java
+
+[33mcommit 2deb06c045307fbdb7e92b4bf38234b234c0a62c[m
+Merge: af7068c ae5f2a4
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Mon Oct 4 19:39:24 2021 +0530
+
+ Merge pull request #40 from Saurabh2509/main
+
+ Vector.java
+
+[33mcommit d8ad86677256958329673336846f60f3ec0865d1[m
+Author: Abhijeet Kumar Ghosh <60868332+abhijeet49@users.noreply.github.com>
+Date: Mon Oct 4 19:38:21 2021 +0530
+
+ Add files via upload
+
+[33mcommit ae5f2a458fe1047fae2920db41b414ad693be5e2[m
+Author: Saurabh Kumar <54509629+Saurabh2509@users.noreply.github.com>
+Date: Mon Oct 4 19:36:52 2021 +0530
+
+ Vector.java
+
+ Vector Implementation
+
+[33mcommit af7068ca434479e214cacb0798b39371ec65f974[m
+Merge: 542c967 748f139
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Mon Oct 4 19:34:53 2021 +0530
+
+ Merge pull request #39 from Saurabh2509/main
+
+ ArrayList.java
+
+[33mcommit 748f139303a8d6a80d9fecb5863ae4376c5e836c[m
+Author: Saurabh Kumar <54509629+Saurabh2509@users.noreply.github.com>
+Date: Mon Oct 4 19:34:11 2021 +0530
+
+ ArrayList.java
+
+ Arraylist.java Added
+
+[33mcommit 542c967710ed7d5f0ae8f6feb1b61a0089aaa149[m
+Merge: eaac131 6ae4418
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Mon Oct 4 19:28:37 2021 +0530
+
+ Merge pull request #38 from Saurabh2509/main
+
+ Added Linkedlistdeque.java
+
+[33mcommit 6ae4418eba750d92db1cd118331aa68861834c25[m
+Author: Saurabh Kumar <54509629+Saurabh2509@users.noreply.github.com>
+Date: Mon Oct 4 19:26:49 2021 +0530
+
+ Added Linkedlistdeque.java
+
+[33mcommit eaac131784e1150c82a03fbc7d99853e6f225a94[m
+Merge: 5dedb79 2101153
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Mon Oct 4 19:24:30 2021 +0530
+
+ Merge pull request #37 from Saurabh2509/main
+
+ Add files via upload
+
+[33mcommit 2101153ddf1238230e44eb5d1e7ff20df274b71f[m
+Author: Saurabh Kumar <54509629+Saurabh2509@users.noreply.github.com>
+Date: Mon Oct 4 19:22:58 2021 +0530
+
+ Add files via upload
+
+[33mcommit 5dedb79662c550c22ede932516e87c68539598da[m
+Merge: 0b6fe20 3d09c77
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Mon Oct 4 18:16:06 2021 +0530
+
+ Merge pull request #36 from aarush2410/main
+
+ isbn
+
+[33mcommit 3d09c778b275b8d637524571765eab9719a18b36[m
+Author: aarush2410 <76821730+aarush2410@users.noreply.github.com>
+Date: Mon Oct 4 18:15:32 2021 +0530
+
+ isbn
+
+[33mcommit 0b6fe20b4dbfff4823e7df22282b8a629878eba6[m
+Merge: 9dda5aa 16722e2
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Mon Oct 4 18:15:24 2021 +0530
+
+ Merge pull request #35 from VinayKumar1512/main
+
+ Print Maze Paths
+
+[33mcommit 9dda5aa47a02c57e9bd7678470b6db69dc4f39d8[m
+Merge: 387313e 7513bb0
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Mon Oct 4 18:12:22 2021 +0530
+
+ Merge pull request #34 from aarush2410/main
+
+ sunny
+
+[33mcommit 7513bb082df6ff03139c5d7f7c525f6c9fd0bf91[m
+Author: aarush2410 <76821730+aarush2410@users.noreply.github.com>
+Date: Mon Oct 4 18:11:54 2021 +0530
+
+ evil
+
+[33mcommit 7e092492a1a34460aafd74bc920e618ea73665a8[m
+Author: aarush2410 <76821730+aarush2410@users.noreply.github.com>
+Date: Mon Oct 4 18:11:00 2021 +0530
+
+ evil
+
+[33mcommit 16722e2c33910e4b06b4820101a4ba79692488a1[m
+Author: Vinay Kumar <79040443+VinayKumar1512@users.noreply.github.com>
+Date: Mon Oct 4 18:10:02 2021 +0530
+
+ Add files via upload
+
+[33mcommit 72fc3c67ec4d4782bf95ab485e58c6a8f013cca2[m
+Author: aarush2410 <76821730+aarush2410@users.noreply.github.com>
+Date: Mon Oct 4 18:09:11 2021 +0530
+
+ sunny
+
+[33mcommit 387313ee164367f2b376d825e914f7cdc0576680[m
+Merge: a12b2f3 cf3ead0
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Mon Oct 4 18:07:36 2021 +0530
+
+ Merge pull request #33 from aarush2410/main
+
+ left triangle
+
+[33mcommit cf3ead07bcbe67f303f465593d7036a27aa2596c[m
+Author: aarush2410 <76821730+aarush2410@users.noreply.github.com>
+Date: Mon Oct 4 18:07:13 2021 +0530
+
+ ascii
+
+[33mcommit 1061f922e5e0eedaa51e2c774055b65c3394723b[m
+Author: aarush2410 <76821730+aarush2410@users.noreply.github.com>
+Date: Mon Oct 4 18:05:32 2021 +0530
+
+ left triangle
+
+[33mcommit a12b2f3edb00303f376582ab5afa54945d47e2a4[m
+Merge: 589a725 076e8bb
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Mon Oct 4 18:04:30 2021 +0530
+
+ Merge pull request #32 from aarush2410/main
+
+ jdbc java
+
+[33mcommit 589a725473f49c01199799a1426d92aa1670bb8a[m
+Merge: 5213ecc 4b20b7b
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Mon Oct 4 18:03:56 2021 +0530
+
+ Merge pull request #30 from bodhiaditya/main
+
+ Binary Tree Traversals.
+
+[33mcommit 076e8bb729d1c6b3b6b4d4785b397b5c7ae2f781[m
+Author: aarush2410 <76821730+aarush2410@users.noreply.github.com>
+Date: Mon Oct 4 18:03:39 2021 +0530
+
+ jdbc java
+
+[33mcommit 5213eccaddeba851daeb7c3f613bf2510ba183d5[m
+Merge: 02ba74f 2df327d
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Mon Oct 4 18:03:31 2021 +0530
+
+ Merge pull request #31 from aarush2410/main
+
+ Fibonnaci program
+
+[33mcommit 2df327d03a90f566af40e4c168e42cb31a34635c[m
+Author: aarush2410 <76821730+aarush2410@users.noreply.github.com>
+Date: Mon Oct 4 18:01:10 2021 +0530
+
+ Fibonnaci program
+
+[33mcommit 4b20b7baa300e1ff9cb92f2b100487071a61c62a[m
+Author: Aditya
+Date: Mon Oct 4 12:56:18 2021 +0530
+
+ BinaryTree Traversals.
+
+[33mcommit 02ba74f06004791c9e1bd82663636a26b20d6320[m
+Merge: 229a794 41ca5cb
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Mon Oct 4 12:36:08 2021 +0530
+
+ Merge pull request #29 from abhijeet49/main
+
+ Added evenodd.java file
+
+[33mcommit 229a7946abdd6fda23375d2575b14403858f4a0a[m
+Merge: fcf207b b4612f6
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Mon Oct 4 12:35:03 2021 +0530
+
+ Merge pull request #28 from vaibhavss08/main
+
+ Create InsertionSort.java
+
+[33mcommit 41ca5cb0abb74e0679a8d05cfdcfd2dc67b0dc51[m
+Author: Abhijeet Kumar Ghosh <60868332+abhijeet49@users.noreply.github.com>
+Date: Mon Oct 4 12:34:51 2021 +0530
+
+ Add files via upload
+
+[33mcommit b4612f631ba24f32316dddec5934b09d35b1eb2c[m
+Author: vaibhavss08 <81666621+vaibhavss08@users.noreply.github.com>
+Date: Mon Oct 4 12:32:29 2021 +0530
+
+ Create InsertionSort.java
+
+[33mcommit fcf207b19c5f06f289c2435a5229f4300cf42e9c[m
+Merge: 5c156e4 db052ac
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Mon Oct 4 12:30:06 2021 +0530
+
+ Merge pull request #27 from abhijeet49/main
+
+ Added SegmentTreeRMQ.java file
+
+[33mcommit db052acd79db569dac99fe8258f4337e19d1a02e[m
+Author: Abhijeet Kumar Ghosh <60868332+abhijeet49@users.noreply.github.com>
+Date: Mon Oct 4 12:28:37 2021 +0530
+
+ Added SegmentTreeRMQ.java file
+
+[33mcommit 5c156e46e4acbebfde1d88c17b76b25a6171673b[m
+Merge: 2c4cf5c 6f4bba2
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Mon Oct 4 12:24:47 2021 +0530
+
+ Merge pull request #26 from shivu2806/main
+
+ added priorityQueue.java
+
+[33mcommit 6f4bba2515d7a4a81fc42c012b038d2315f8d6e7[m
+Author: shivu2806 <91802335+shivu2806@users.noreply.github.com>
+Date: Mon Oct 4 12:23:50 2021 +0530
+
+ initial commit
+
+[33mcommit 2c4cf5c983f9a56180818a028afd5ca664753cd3[m
+Merge: 1d21e56 b032dd9
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Mon Oct 4 01:00:54 2021 +0530
+
+ Merge pull request #23 from Zaman3027/Mahafuz
+
+ added mergesort
+
+[33mcommit 1d21e56579ce12d90f965af757a608e17db3e983[m
+Merge: 2fe4d59 5df51a4
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Mon Oct 4 01:00:31 2021 +0530
+
+ Merge pull request #24 from TharinduK97/addpro
+
+ Day time server
+
+[33mcommit 2fe4d59efdfd89d70322da4c752cb370b4d39faa[m
+Merge: 70f42f6 19fc6b7
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Mon Oct 4 01:00:10 2021 +0530
+
+ Merge pull request #25 from abhijeet49/main
+
+ Added Frequency.java file
+
+[33mcommit 19fc6b7267e44f9c9e04564f9184bb089526d1e1[m
+Author: Abhijeet Kumar Ghosh <60868332+abhijeet49@users.noreply.github.com>
+Date: Mon Oct 4 00:58:12 2021 +0530
+
+ Added Frequency.java file
+
+[33mcommit 5df51a4a50425241e70b2b739cba2967376925aa[m
+Author: Tharindu Kumarasinghe <57245404+TharinduK97@users.noreply.github.com>
+Date: Sun Oct 3 23:40:05 2021 +0530
+
+ Day time server
+
+[33mcommit b032dd91c016b6730eda28e2ac9e01a4b8db8c97[m
+Author: Zaman3027
+Date: Sun Oct 3 22:43:12 2021 +0530
+
+ added mergesort
+
+[33mcommit 70f42f6dcf67b7ca6ae429deb3e76b900898696b[m
+Merge: c2a26a9 20b02a3
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 3 22:29:11 2021 +0530
+
+ Merge pull request #22 from Ayush167/main
+
+ Sample4.java
+
+[33mcommit 20b02a3abcacebc34104e6167b6f9211c07a1cf6[m
+Author: Ayush167 <57669505+Ayush167@users.noreply.github.com>
+Date: Sun Oct 3 22:27:11 2021 +0530
+
+ Add files via upload
+
+[33mcommit c2a26a9704d0eb68b584fc53c510fb3fac3ed254[m
+Merge: b3821e1 23ccdca
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 3 22:26:34 2021 +0530
+
+ Merge pull request #21 from Ayush167/main
+
+ Sample3.java
+
+[33mcommit 23ccdca903cbc84665b2663498ea4dcc4ccacdb1[m
+Author: Ayush167 <57669505+Ayush167@users.noreply.github.com>
+Date: Sun Oct 3 22:25:11 2021 +0530
+
+ Add files via upload
+
+[33mcommit 1ff36d20ffeb94fe8ecb295deeb0b18caf868670[m
+Author: Ayush167 <57669505+Ayush167@users.noreply.github.com>
+Date: Sun Oct 3 22:24:32 2021 +0530
+
+ Add files via upload
+
+[33mcommit b3821e1a7c892324aff8d97d61e20626e1ba9aec[m
+Merge: 97239c7 00ebf9f
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 3 22:23:42 2021 +0530
+
+ Merge pull request #20 from Ayush167/main
+
+ Sample2.java
+
+[33mcommit 00ebf9fd67e373f43069815f2af42ec7cdef8604[m
+Author: Ayush167 <57669505+Ayush167@users.noreply.github.com>
+Date: Sun Oct 3 22:22:40 2021 +0530
+
+ Add files via upload
+
+[33mcommit 97239c756450d01997598ecf4c57ecc6c277a886[m
+Merge: 45f3a2c 50d194f
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 3 22:21:14 2021 +0530
+
+ Merge pull request #19 from Ayush167/main
+
+ Ayush.java
+
+[33mcommit 50d194f441966f39c5d28ced8d81e299f024c66c[m
+Author: Ayush167 <57669505+Ayush167@users.noreply.github.com>
+Date: Sun Oct 3 22:19:21 2021 +0530
+
+ Add files via upload
+
+[33mcommit 45f3a2c9b76d9f549f60fb61b5b2c87b530e6adc[m
+Merge: ef4e1f8 dd1594e
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 3 22:17:03 2021 +0530
+
+ Merge pull request #16 from MarkoKosmajac/java-aes-encryption-decryption
+
+ AES java algorithm
+
+[33mcommit ef4e1f865ffc4faa8df935ebcbdd001d66ca2800[m
+Merge: ced9b07 63fc7ba
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 3 22:16:02 2021 +0530
+
+ Merge pull request #18 from Ayush167/main
+
+ Sample.java
+
+[33mcommit ced9b07706b0e4fcba7cd2bf7a6f3ce45b25b9ab[m
+Merge: c9a2bd7 0a14a84
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 3 22:15:42 2021 +0530
+
+ Merge pull request #17 from AbhinandanAdhikari/java-zigzag
+
+ Java Program to Print Numbers in ZigZag Pattern
+
+[33mcommit 63fc7ba3f6ec0d6904048b7235a7f17fa7119720[m
+Author: Ayush167 <57669505+Ayush167@users.noreply.github.com>
+Date: Sun Oct 3 22:11:30 2021 +0530
+
+ Add files via upload
+
+[33mcommit 0a14a84902119426cb2a1b26332c2dc232ac504a[m
+Author: Abhinandan Adhikari
+Date: Sun Oct 3 19:05:18 2021 +0530
+
+ Java Program for ZigZag Pattern
+
+[33mcommit dd1594e191614653f323be80f647de9b0bff7c09[m
+Author: Thefaxepower
+Date: Sun Oct 3 15:08:05 2021 +0200
+
+ AES java algoritgm
+
+[33mcommit c9a2bd7d1d88754ed706cecacc12b8eb01648e82[m
+Merge: 33f7207 48cf263
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 3 18:33:47 2021 +0530
+
+ Merge pull request #14 from Venkatesh-24/main
+
+ Added Shell Sort and Quick Sort
+
+[33mcommit 33f7207e45709fd5254c78d143ff78ef77fca4c6[m
+Merge: 9b77675 4a6b4e8
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 3 18:33:20 2021 +0530
+
+ Merge pull request #15 from AbhinandanAdhikari/java-bubblesort
+
+ Added Java program for BubbleSort
+
+[33mcommit 4a6b4e83aca37b9d1f0aad9e010b0b7ab623a775[m
+Author: Abhinandan Adhikari
+Date: Sun Oct 3 13:06:34 2021 +0530
+
+ Added Java program for BubbleSort
+
+[33mcommit 48cf263b12413b438e2ebb8a1254e79faed28bde[m
+Author: Venkatesh-24
+Date: Sun Oct 3 12:40:26 2021 +0530
+
+ Added Shell Sort and Quick Sort
+
+[33mcommit 9b77675c41019004b742d33732d271aad7c9df99[m
+Merge: f23fe73 438e9dc
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 3 12:28:05 2021 +0530
+
+ Merge pull request #13 from jotdeep/main
+
+ Added Longest Common Subsequence
+
+[33mcommit 438e9dc4185cf3abf022fa6387123ce9dd9c8ab4[m
+Author: jotdeep <59995823+jotdeep@users.noreply.github.com>
+Date: Sun Oct 3 11:47:55 2021 +0530
+
+ Added Longest Common Subsequence
+
+[33mcommit f23fe73c68120192666c909ce7916b7489c4fdeb[m
+Merge: 7b5c2f0 608bfe1
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 3 11:28:43 2021 +0530
+
+ Merge pull request #12 from abhishekprasad2384/main
+
+ Create Kth Smallest Element in a BST
+
+[33mcommit 608bfe18584c6c6125c1fd5a5e316c725dc69db6[m
+Author: abhishekprasad2384 <49679013+abhishekprasad2384@users.noreply.github.com>
+Date: Sun Oct 3 09:10:55 2021 +0530
+
+ Create Kth Smallest Element in a BST
+
+[33mcommit 7b5c2f05f2cec4072561d57e3248385553763a18[m
+Merge: cc5ebe8 8a51e2d
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 3 08:30:12 2021 +0530
+
+ Merge pull request #11 from dvir019/patch-1
+
+ Create ArraySum.java
+
+[33mcommit 8a51e2d8848909baf0f453a323f08d9f072880bd[m
+Author: dvir019 <30556126+dvir019@users.noreply.github.com>
+Date: Sun Oct 3 00:04:21 2021 +0300
+
+ Create ArraySum.java
+
+[33mcommit cc5ebe8f96dcc8ddd0481d7159a4b9ff8b2ac29f[m
+Merge: 2fc7f78 c3c6004
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 3 01:56:40 2021 +0530
+
+ Merge pull request #10 from Mystery-2-Dev/main
+
+ Create assendingArray.java
+
+[33mcommit c3c6004d7172cbf0cb9b115d21cefc1661a9b751[m
+Author: Mysterious-Developer
+Date: Sun Oct 3 01:45:53 2021 +0530
+
+ Create assendingArray.java
+
+[33mcommit 2fc7f780c732537a0247b5ebe4dadd08198dddd7[m
+Merge: ab981f3 d093aeb
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 3 01:32:46 2021 +0530
+
+ Merge pull request #9 from shivu2806/main
+
+ Create egyptianFraction.java
+
+[33mcommit d093aeb1b99fbd269dd587f18113565455bc6790[m
+Author: shivu2806 <91802335+shivu2806@users.noreply.github.com>
+Date: Sun Oct 3 01:31:44 2021 +0530
+
+ Create egyptianFraction.java
+
+[33mcommit ab981f397d1542c7400e22c1d180752fbed6d012[m
+Merge: 9f7f6d7 c29394e
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 3 01:28:43 2021 +0530
+
+ Merge pull request #7 from Raghav-Gupta22/patch-1
+
+ Create WordCounter.java
+
+[33mcommit 9f7f6d790147aa651ca9c5dd1c3b4e621b5d260f[m
+Merge: c6e8ded 9c6370c
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 3 01:28:24 2021 +0530
+
+ Merge pull request #8 from shivu2806/main
+
+ Create wordBreak.java
+
+[33mcommit 9c6370cad4cfc4d276fcb88b90a2b5538d978fa6[m
+Author: shivu2806 <91802335+shivu2806@users.noreply.github.com>
+Date: Sun Oct 3 01:27:12 2021 +0530
+
+ Create wordBreak.java
+
+[33mcommit c29394e969ec5379e0cb4d6b6856525fb1a369c6[m
+Author: Raghav Gupta
+Date: Sun Oct 3 01:22:51 2021 +0530
+
+ Create WordCounter.java
+
+ Java program to count no of words from given input string.
+
+[33mcommit c6e8ded8684faa456e58b28886ae297c9563cd37[m
+Merge: 13407e4 18fad71
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 3 01:19:28 2021 +0530
+
+ Merge pull request #6 from shivu2806/main
+
+ topologicalSorting.java
+
+[33mcommit 18fad717d18f7dc5245ab7275993f57c379d5237[m
+Author: shivu2806 <91802335+shivu2806@users.noreply.github.com>
+Date: Sun Oct 3 01:18:37 2021 +0530
+
+ initial
+
+[33mcommit 13407e4a32f14254335732517056689966cba595[m
+Merge: ecb8dab ea0c5ef
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 3 01:16:21 2021 +0530
+
+ Merge pull request #5 from shivu2806/main
+
+ matrixChain.java
+
+[33mcommit ea0c5efeb1331bb96aaadee066fc21635d34e787[m
+Author: shivu2806 <91802335+shivu2806@users.noreply.github.com>
+Date: Sun Oct 3 01:15:57 2021 +0530
+
+ initial
+
+[33mcommit c1cd1d0d54e0fb87eb8b95c4e47008fa4bf3caad[m
+Author: shivu2806 <91802335+shivu2806@users.noreply.github.com>
+Date: Sun Oct 3 01:11:37 2021 +0530
+
+ createdminCost
+
+[33mcommit 61e4d11a232500888f5083d0e27874720beed9a3[m
+Author: shivu2806 <91802335+shivu2806@users.noreply.github.com>
+Date: Sun Oct 3 01:10:06 2021 +0530
+
+ initial
+
+[33mcommit ecb8dab7cf908fca7cdd51e529796fb0db8bf544[m
+Merge: 77cbedf d67ac89
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 3 01:09:07 2021 +0530
+
+ Merge pull request #2 from Mystery-2-Dev/patch-2
+
+ Create unicode.java
+
+[33mcommit 77cbedfce9ce0551598cb0ec325463479143b061[m
+Merge: bfaaf6e 55f5394
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 3 01:08:55 2021 +0530
+
+ Merge pull request #3 from Mystery-2-Dev/patch-3
+
+ Create diagonalSum.java
+
+[33mcommit bfaaf6e825b5e90869ef094db4346382f32ad061[m
+Merge: 4ca4062 855ff4c
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 3 01:08:39 2021 +0530
+
+ Merge pull request #4 from Mystery-2-Dev/patch-4
+
+ Create ElementbetweenArray.java
+
+[33mcommit 855ff4c2741aa2aed6397f2d3ac90c3eda16afaa[m
+Author: Mysterious-Developer
+Date: Sun Oct 3 01:06:33 2021 +0530
+
+ Create ElementbetweenArray.java
+
+[33mcommit 55f53948528ec3af742f2f1a029333fbe0fa3d0f[m
+Author: Mysterious-Developer
+Date: Sun Oct 3 01:04:12 2021 +0530
+
+ Create diagonalSum.java
+
+[33mcommit d67ac89ef8dadecc551869527c8c3ff1dc36691f[m
+Author: Mysterious-Developer
+Date: Sun Oct 3 01:01:39 2021 +0530
+
+ Create unicode.java
+
+[33mcommit 4ca4062476c02e93e6f3d09cefdc3f95c21f9997[m
+Merge: cb261a8 27842f6
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 3 00:59:51 2021 +0530
+
+ Merge pull request #1 from Mystery-2-Dev/patch-1
+
+ Create stringUsage.java
+
+[33mcommit 27842f6aa1c5d66affde842d145e287ac09c1a7d[m
+Author: Mysterious-Developer
+Date: Sun Oct 3 00:59:13 2021 +0530
+
+ Create stringUsage.java
+
+[33mcommit cb261a847ae6006a89ddcba8fe2d88523cadb4da[m
+Author: Aakash kumar sahoo <56172886+jvm-coder@users.noreply.github.com>
+Date: Sun Oct 3 00:55:18 2021 +0530
+
+ Initial commit
diff --git a/armstrongNumber.java b/armstrongNumber.java
new file mode 100644
index 0000000..3079887
--- /dev/null
+++ b/armstrongNumber.java
@@ -0,0 +1,41 @@
+// Program to determine whether the number is Armstrong number or not
+public class Armstrong {
+ // Function to calculate x raised to the power y
+ int power(int x, long y) {
+ if( y == 0)
+ return 1;
+ if (y%2 == 0)
+ return power(x, y/2)*power(x, y/2);
+ return x*power(x, y/2)*power(x, y/2);
+ }
+
+ // Function to calculate order of the number
+ int order(int x) {
+ int n = 0;
+ while (x != 0) {
+ n++;
+ x = x/10;
+ }
+ return n;
+ }
+
+ boolean isArmstrong (int x) {
+ // Calling order function
+ int n = order(x);
+ int temp=x, sum=0;
+ while (temp!=0) {
+ int r = temp%10;
+ sum = sum + power(r,n);
+ temp = temp/10;
+ }
+ return (sum == x);
+ }
+
+ public static void main(String[] args) {
+ Armstrong ob = new Armstrong();
+ int x = 153;
+ System.out.println(ob.isArmstrong(x));
+ x = 1253;
+ System.out.println(ob.isArmstrong(x));
+ }
+}
diff --git a/climbing-stairs.java b/climbing-stairs.java
new file mode 100644
index 0000000..e293edc
--- /dev/null
+++ b/climbing-stairs.java
@@ -0,0 +1,22 @@
+// https://leetcode.com/problems/climbing-stairs/
+
+public class Solution {
+ public int climbStairs(int n) {
+
+ return climb_Stairs(0, n, new int[n + 1]);
+ }
+
+ public int climb_Stairs(int i, int n, int dp[]) {
+ if (i > n) {
+ return 0;
+ }
+ if (i == n) {
+ return 1;
+ }
+ if (dp[i] > 0) {
+ return dp[i];
+ }
+ dp[i] = climb_Stairs(i + 1, n, dp) + climb_Stairs(i + 2, n, dp);
+ return dp[i];
+ }
+}
\ No newline at end of file
diff --git a/dijkstrasAlgorithm.java b/dijkstrasAlgorithm.java
new file mode 100644
index 0000000..4894fd2
--- /dev/null
+++ b/dijkstrasAlgorithm.java
@@ -0,0 +1,176 @@
+// Java Program to Implement Dijkstra's Algorithm
+// Using Priority Queue
+
+
+import java.util.*;
+
+
+public class GFG {
+
+
+ private int dist[];
+ private Set settled;
+ private PriorityQueue pq;
+
+ private int V;
+ List > adj;
+
+ // Constructor of this class
+ public GFG(int V)
+ {
+
+ // This keyword refers to current object itself
+ this.V = V;
+ dist = new int[V];
+ settled = new HashSet();
+ pq = new PriorityQueue(V, new Node());
+ }
+
+ // Method 1
+ // Dijkstra's Algorithm
+ public void dijkstra(List > adj, int src)
+ {
+ this.adj = adj;
+
+ for (int i = 0; i < V; i++)
+ dist[i] = Integer.MAX_VALUE;
+
+ // Add source node to the priority queue
+ pq.add(new Node(src, 0));
+
+ // Distance to the source is 0
+ dist[src] = 0;
+
+ while (settled.size() != V) {
+
+ // Terminating ondition check when
+ // the priority queue is empty, return
+ if (pq.isEmpty())
+ return;
+
+ // Removing the minimum distance node
+ // from the priority queue
+ int u = pq.remove().node;
+
+ // Adding the node whose distance is
+ // finalized
+ if (settled.contains(u))
+
+ // Continue keyword skips exwcution for
+ // following check
+ continue;
+
+ // We don't have to call e_Neighbors(u)
+ // if u is already present in the settled set.
+ settled.add(u);
+
+ e_Neighbours(u);
+ }
+ }
+
+ // Method 2
+ // To process all the neighbours
+ // of the passed node
+ private void e_Neighbours(int u)
+ {
+
+ int edgeDistance = -1;
+ int newDistance = -1;
+
+ // All the neighbors of v
+ for (int i = 0; i < adj.get(u).size(); i++) {
+ Node v = adj.get(u).get(i);
+
+ // If current node hasn't already been processed
+ if (!settled.contains(v.node)) {
+ edgeDistance = v.cost;
+ newDistance = dist[u] + edgeDistance;
+
+ // If new distance is cheaper in cost
+ if (newDistance < dist[v.node])
+ dist[v.node] = newDistance;
+
+ // Add the current node to the queue
+ pq.add(new Node(v.node, dist[v.node]));
+ }
+ }
+ }
+
+ // Main driver method
+ public static void main(String arg[])
+ {
+
+ int V = 5;
+ int source = 0;
+
+ // Adjacency list representation of the
+ // connected edges by declaring List class object
+ // Declaring object of type List
+ List > adj
+ = new ArrayList >();
+
+ // Initialize list for every node
+ for (int i = 0; i < V; i++) {
+ List item = new ArrayList();
+ adj.add(item);
+ }
+
+ // Inputs for the GFG(dpq) graph
+ adj.get(0).add(new Node(1, 9));
+ adj.get(0).add(new Node(2, 6));
+ adj.get(0).add(new Node(3, 5));
+ adj.get(0).add(new Node(4, 3));
+
+ adj.get(2).add(new Node(1, 2));
+ adj.get(2).add(new Node(3, 4));
+
+ // Calculating the single source shortest path
+ GFG dpq = new GFG(V);
+ dpq.dijkstra(adj, source);
+
+ // Printing the shortest path to all the nodes
+ // from the source node
+ System.out.println("The shorted path from node :");
+
+ for (int i = 0; i < dpq.dist.length; i++)
+ System.out.println(source + " to " + i + " is "
+ + dpq.dist[i]);
+ }
+}
+
+// Class 2
+// Helper class implementing Comparator interface
+// Representing a node in the graph
+class Node implements Comparator {
+
+ // Member variables of this class
+ public int node;
+ public int cost;
+
+ // Constructors of this class
+
+ // Constructor 1
+ public Node() {}
+
+ // Constructor 2
+ public Node(int node, int cost)
+ {
+
+ // This keyword refers to current instance itself
+ this.node = node;
+ this.cost = cost;
+ }
+
+ // Method 1
+ @Override public int compare(Node node1, Node node2)
+ {
+
+ if (node1.cost < node2.cost)
+ return -1;
+
+ if (node1.cost > node2.cost)
+ return 1;
+
+ return 0;
+ }
+}
diff --git a/djikstra.java b/djikstra.java
new file mode 100644
index 0000000..43cb072
--- /dev/null
+++ b/djikstra.java
@@ -0,0 +1,164 @@
+import java.util.Scanner;
+import java.util.Arrays;
+
+class Node{
+ int val;
+ int weight;
+ Node next;
+
+ public Node(int val,int weight){
+ this.val = val;
+ this.weight = weight;
+ this.next = null;
+ }
+}
+
+class Graph{
+
+ public Node[] CreateGraph(int n){
+ Node[] Graph = new Node[n];
+ return Graph;
+ }
+
+ /* This Function adds Edge between the Source and Destination */
+
+ public void AddEdge(Node[] Graph,int src,int dest,int weight){
+
+
+ if(Graph[src] == null){
+
+ Graph[src] = new Node(dest,weight);
+ return;
+
+ }
+
+ else{
+
+ Node temp = new Node(dest,weight);
+
+ temp.next = Graph[src];
+
+ Graph[src] = temp;
+
+ }
+
+ }
+
+ /* This Function returns the Index of the Node that has the Least Shortest Distance and is UnVisited. */
+
+ public int MinIndex(int[] dist,boolean[] visited){
+ int min = Integer.MAX_VALUE;
+ int min_index = -1;
+
+ for(int i = 0;i dist[i]){
+ min = dist[i];
+ min_index = i;
+ }
+ }
+
+ return min_index;
+ }
+
+}
+
+
+public class djikstra {
+ public static void main(String[] args) {
+
+ Scanner scan = new Scanner(System.in);
+
+ Graph g = new Graph();
+
+
+ System.out.print("Enter the Number of Nodes in the Graph : ");
+
+ int num = scan.nextInt();
+
+ Node[] Graph = g.CreateGraph(num);
+
+ System.out.print("Enter the Total Number of Edges in the Graph : ");
+
+ int edges = scan.nextInt();
+
+ System.out.println("Now Enter all the Edges as Source Destination Weight");
+
+ /* Storing the edges */
+
+ for(int i = 0;i dist[min_index] + temp.weight && !visited[temp.val]){
+ dist[temp.val] = dist[min_index] + temp.weight;
+ }
+
+ temp = temp.next;
+
+ }
+ }
+
+ /* Printing the Shortest Distances from the Start Node to all the other Nodes */
+
+ for(int i = 0;i {
+ private class HTPair {
+ K key;
+ V value;
+
+ public HTPair(K key, V value) {
+ this.key = key;
+ this.value = value;
+ }
+
+ public boolean equals(Object other) {
+ HTPair op = (HTPair) other;
+ return this.key.equals(op.key);
+ }
+
+ public String toString() {
+ return "{" + this.key + "->" + this.value + "}";
+ }
+ }
+
+ private LinkedList[] bucketArray;
+ private int size;
+
+ public static final int DEFAULT_CAPACITY = 5;
+
+ public HashTable() {
+ this(DEFAULT_CAPACITY);
+ }
+
+ public HashTable(int capacity) {
+ this.bucketArray = (LinkedList[]) new LinkedList[capacity];
+ this.size = 0;
+ }
+
+ public int size() {
+ return this.size;
+ }
+
+ private int HashFunction(K key) {
+ int hc = key.hashCode();
+ hc = Math.abs(hc);
+ int bi = hc % this.bucketArray.length;
+ return bi;
+ }
+
+ public void put(K key, V value) throws Exception {
+ int bi = HashFunction(key);
+ HTPair data = new HTPair(key, value);
+ if (this.bucketArray[bi] == null) {
+ LinkedList bucket = new LinkedList<>();
+ bucket.addLast(data);
+ this.size++;
+ this.bucketArray[bi] = bucket;
+ } else {
+ int foundAt = this.bucketArray[bi].find(data);
+ if (foundAt == -1) {
+ this.bucketArray[bi].addLast(data);
+ this.size++;
+ } else {
+ HTPair obj = this.bucketArray[bi].getAt(foundAt);
+ obj.value = value;
+ this.size++;
+ }
+ }
+ double lambda = (this.size) * 1.0;
+ lambda = this.size / this.bucketArray.length;
+ if (lambda > 0.75) {
+ rehash();
+ }
+ }
+
+ public void display() {
+ for (LinkedList list : this.bucketArray) {
+ if (list != null && !list.isEmpty()) {
+ list.display();
+ } else {
+ System.out.println("NULL");
+ }
+ }
+ }
+
+ public V get(K key) throws Exception {
+ int index = this.HashFunction(key);
+ LinkedList list = this.bucketArray[index];
+ HTPair ptf = new HTPair(key, null);
+ if (list == null) {
+ return null;
+ } else {
+ int findAt = list.find(ptf);
+ if (findAt == -1) {
+ return null;
+ } else {
+ HTPair pair = list.getAt(findAt);
+ return pair.value;
+ }
+ }
+ }
+
+ public V remove(K key) throws Exception {
+ int index = this.HashFunction(key);
+ LinkedList list = this.bucketArray[index];
+ HTPair ptf = new HTPair(key, null);
+ if (list == null) {
+ return null;
+ } else {
+ int findAt = list.find(ptf);
+ if (findAt == -1) {
+ return null;
+ } else {
+ HTPair pair = list.getAt(findAt);
+ list.removeAt(findAt);
+ this.size--;
+ return pair.value;
+ }
+ }
+ }
+
+ public void rehash() throws Exception {
+ LinkedList[] oba = this.bucketArray;
+ this.bucketArray = (LinkedList[]) new LinkedList[2 * oba.length];
+ this.size = 0;
+ for (LinkedList ob : oba) {
+ while (ob != null && !ob.isEmpty()) {
+ HTPair pair = ob.removeFirst();
+ this.put(pair.key, pair.value);
+ }
+ }
+ }
+}
diff --git a/java_database_connectivity.java b/java_database_connectivity.java
new file mode 100644
index 0000000..9317715
--- /dev/null
+++ b/java_database_connectivity.java
@@ -0,0 +1,49 @@
+package testdatabase;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+class TestDatabase28
+{
+ public static void main(String args[])
+ {
+ Connection con = null;
+ Statement st = null;
+ ResultSet rs = null;
+
+ try
+ {
+ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
+ System.out.println("Driver Loaded");
+
+ con = DriverManager.getConnection("jdbc:odbc:db28");
+ System.out.println("Connected");
+
+ st = con.createStatement();
+
+ String query = "Select * from emp";
+
+ rs = st.executeQuery(query);
+
+ while (rs.next())
+ {
+ System.out.print(rs.getString(1) + "\t");
+ System.out.print(rs.getString(2) + "\t");
+ System.out.print(rs.getString(3) + "\t");
+ System.out.println(rs.getString(4));
+ }
+ con.close();
+ }
+ catch (ClassNotFoundException e)
+ {
+ System.out.println(e);
+ }
+ catch (SQLException e)
+ {
+ System.out.println(e);
+ }
+ }
+}
diff --git a/knight__tour.java b/knight__tour.java
new file mode 100644
index 0000000..3bd4625
--- /dev/null
+++ b/knight__tour.java
@@ -0,0 +1,99 @@
+import java.util.*;
+
+public class KnightsTour {
+ private final static int base = 12;
+ private final static int[][] moves = {{1,-2},{2,-1},{2,1},{1,2},{-1,2},
+ {-2,1},{-2,-1},{-1,-2}};
+ private static int[][] grid;
+ private static int total;
+
+ public static void main(String[] args) {
+ grid = new int[base][base];
+ total = (base - 4) * (base - 4);
+
+ for (int r = 0; r < base; r++)
+ for (int c = 0; c < base; c++)
+ if (r < 2 || r > base - 3 || c < 2 || c > base - 3)
+ grid[r][c] = -1;
+
+ int row = 2 + (int) (Math.random() * (base - 4));
+ int col = 2 + (int) (Math.random() * (base - 4));
+
+ grid[row][col] = 1;
+
+ if (solve(row, col, 2))
+ printResult();
+ else System.out.println("no result");
+
+ }
+
+ private static boolean solve(int r, int c, int count) {
+ if (count > total)
+ return true;
+
+ List nbrs = neighbors(r, c);
+
+ if (nbrs.isEmpty() && count != total)
+ return false;
+
+ Collections.sort(nbrs, new Comparator() {
+ public int compare(int[] a, int[] b) {
+ return a[2] - b[2];
+ }
+ });
+
+ for (int[] nb : nbrs) {
+ r = nb[0];
+ c = nb[1];
+ grid[r][c] = count;
+ if (!orphanDetected(count, r, c) && solve(r, c, count + 1))
+ return true;
+ grid[r][c] = 0;
+ }
+
+ return false;
+ }
+
+ private static List neighbors(int r, int c) {
+ List nbrs = new ArrayList<>();
+
+ for (int[] m : moves) {
+ int x = m[0];
+ int y = m[1];
+ if (grid[r + y][c + x] == 0) {
+ int num = countNeighbors(r + y, c + x);
+ nbrs.add(new int[]{r + y, c + x, num});
+ }
+ }
+ return nbrs;
+ }
+
+ private static int countNeighbors(int r, int c) {
+ int num = 0;
+ for (int[] m : moves)
+ if (grid[r + m[1]][c + m[0]] == 0)
+ num++;
+ return num;
+ }
+
+ private static boolean orphanDetected(int cnt, int r, int c) {
+ if (cnt < total - 1) {
+ List nbrs = neighbors(r, c);
+ for (int[] nb : nbrs)
+ if (countNeighbors(nb[0], nb[1]) == 0)
+ return true;
+ }
+ return false;
+ }
+
+ private static void printResult() {
+ for (int[] row : grid) {
+ for (int i : row) {
+ if (i == -1)
+ continue;
+ System.out.printf("%2d ", i);
+ }
+ System.out.println();
+ }
+ }
+}
diff --git a/matrix_multiplication.java b/matrix_multiplication.java
new file mode 100644
index 0000000..fb2c973
--- /dev/null
+++ b/matrix_multiplication.java
@@ -0,0 +1,49 @@
+import java.util.Scanner;
+
+public class MatrixMultiplication{
+ public static void main(String args[]){
+
+ int row1, col1, row2, col2;
+ Scanner s = new Scanner(System.in);
+ System.out.print("Enter number of rows in first matrix:");
+ row1 = s.nextInt();
+ System.out.print("Enter number of columns in first matrix:");
+ col1 = s.nextInt();
+ System.out.print("Enter number of rows in second matrix:");
+ row2 = s.nextInt();
+ System.out.print("Enter number of columns in second matrix:");
+ col2 = s.nextInt();
+
+ if (col1 != row2) {
+ System.out.println("Matrix multiplication is not possible");
+ }
+ else {
+ int a[][] = new int[row1][col1];
+ int b[][] = new int[row2][col2];
+ int c[][] = new int[row1][col2];
+
+ System.out.println("Enter values for matrix A : \n");
+ for (int i = 0; i < row1; i++) {
+ for (int j = 0; j < col1; j++)
+ a[i][j] = s.nextInt();
+ }
+ System.out.println("Enter values for matrix B : \n");
+ for (int i = 0; i < row2; i++) {
+ for (int j = 0; j < col2; j++)
+ b[i][j] = s.nextInt();
+ }
+
+ System.out.println("Matrix multiplication is : \n");
+ for(int i = 0; i < row1; i++) {
+ for(int j = 0; j < col2; j++){
+ c[i][j]=0;
+ for(int k = 0; k < col1; k++){
+ c[i][j] += a[i][k] * b[k][j];
+ }
+ System.out.print(c[i][j] + " ");
+ }
+ System.out.println();
+ }
+ }
+ }
+}
diff --git a/number_diamond.java b/number_diamond.java
new file mode 100644
index 0000000..d09e164
--- /dev/null
+++ b/number_diamond.java
@@ -0,0 +1,37 @@
+import java.util.Scanner;
+
+public class diamond_pattern
+{
+ public static void main(String[] args) {
+ Scanner sc=new Scanner(System.in);
+ System.out.println("Enter number of rows");
+ int n = sc.nextInt();
+ System.out.println("Enter number of colums");
+ int m = sc.nextInt();
+
+ for (int i = 1; i <= n; i++)
+ {
+ //n = 4;
+
+ for (int j = 1; j<= n - i; j++) { System.out.print(" "); } for (int k = i; k >= 1; k--)
+ {
+ System.out.print(k);
+ }
+ for (int l = 2; l <= i; l++) { System.out.print(l); } System.out.println(); } for (int i = 3; i >= 1; i--)
+ {
+ n = 3;
+
+ for (int j = 0; j<= n - i; j++) { System.out.print(" "); } for (int k = i; k >= 1; k--)
+ {
+ System.out.print(k);
+ }
+ for (int l = 2; l <= i; l++)
+ {
+ System.out.print(l);
+ }
+
+ System.out.println();
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/range.cpp b/range.cpp
new file mode 100644
index 0000000..4eb36d0
--- /dev/null
+++ b/range.cpp
@@ -0,0 +1,32 @@
+// C++ program to find total count of an element
+// in a range
+#include
+using namespace std;
+
+// Returns count of element in arr[left-1..right-1]
+int findFrequency(int arr[], int n, int left,
+ int right, int element)
+{
+ int count = 0;
+ for (int i=left-1; i<=right; ++i)
+ if (arr[i] == element)
+ ++count;
+ return count;
+}
+
+// Driver Code
+int main()
+{
+ int arr[] = {2, 8, 6, 9, 8, 6, 8, 2, 11};
+ int n = sizeof(arr) / sizeof(arr[0]);
+
+ // Print frequency of 2 from position 1 to 6
+ cout << "Frequency of 2 from 1 to 6 = "
+ << findFrequency(arr, n, 1, 6, 2) << endl;
+
+ // Print frequency of 8 from position 4 to 9
+ cout << "Frequency of 8 from 4 to 9 = "
+ << findFrequency(arr, n, 4, 9, 8);
+
+ return 0;
+}
diff --git a/rotate_array.java b/rotate_array.java
new file mode 100644
index 0000000..8b612a7
--- /dev/null
+++ b/rotate_array.java
@@ -0,0 +1,47 @@
+package functions;
+import java.io.*;
+
+public class rotate_array {
+ public static void display(int[] a){
+ StringBuilder sb = new StringBuilder();
+
+ for(int val: a){
+ sb.append(val + " ");
+ }
+ System.out.println(sb);
+ }
+ public static void reverse(int[] a, int m, int k){
+ for(int i=m;i x / (mid + 1))// Found the result
+ return mid;
+ else if (mid > x / mid)// Keep checking the left part
+ end = mid;
+ else {
+ start = mid + 1;// Keep checking the right part
+ }
+ }
+ return start;
+ }
+}
diff --git a/topologicalSorting.java b/topologicalSorting.java
index 690177c..ec85870 100644
--- a/topologicalSorting.java
+++ b/topologicalSorting.java
@@ -1,91 +1,53 @@
-// A Java program to print topological
-// sorting of a DAG
-import java.io.*;
import java.util.*;
-
-// This class represents a directed graph
-// using adjacency list representation
-class Graph {
- // No. of vertices
- private int V;
-
- // Adjacency List as ArrayList of ArrayList's
- private ArrayList > adj;
-
- // Constructor
- Graph(int v)
- {
- V = v;
- adj = new ArrayList >(v);
- for (int i = 0; i < v; ++i)
- adj.add(new ArrayList());
+class Graph{
+ int v;
+ LinkedList adj[];
+ @SuppressWarnings("unchecked")
+ Graph(int v){
+ this.v=v;
+ adj=new LinkedList[v];
+ for(int i=0;i();
+ }
+}
+class TopologicalSorting{
+ public static void addEdge(Graph g,int u,int v){
+ g.adj[u].add(v);
}
-
- // Function to add an edge into the graph
- void addEdge(int v, int w) { adj.get(v).add(w); }
-
- // A recursive function used by topologicalSort
- void topologicalSortUtil(int v, boolean visited[],
- Stack stack)
+ public static void toposortutil(Graph g,int node,boolean visit[],Stack st)
{
- // Mark the current node as visited.
- visited[v] = true;
- Integer i;
-
- // Recur for all the vertices adjacent
- // to thisvertex
- Iterator it = adj.get(v).iterator();
- while (it.hasNext()) {
- i = it.next();
- if (!visited[i])
- topologicalSortUtil(i, visited, stack);
+ visit[node]=true;
+ int i;
+ Iteratorit=g.adj[node].iterator();
+ while(it.hasNext())
+ {
+ i=it.next();
+ System.out.println(i);
+ if(!visit[i])
+ toposortutil(g,i,visit,st);
}
-
- // Push current vertex to stack
- // which stores result
- stack.push(new Integer(v));
+ System.out.println("node"+node);
+ st.push(node);
}
-
- // The function to do Topological Sort.
- // It uses recursive topologicalSortUtil()
- void topologicalSort()
- {
- Stack stack = new Stack();
-
- // Mark all the vertices as not visited
- boolean visited[] = new boolean[V];
- for (int i = 0; i < V; i++)
- visited[i] = false;
-
- // Call the recursive helper
- // function to store
- // Topological Sort starting
- // from all vertices one by one
- for (int i = 0; i < V; i++)
- if (visited[i] == false)
- topologicalSortUtil(i, visited, stack);
-
- // Print contents of stack
- while (stack.empty() == false)
- System.out.print(stack.pop() + " ");
+ public static void toposort(Graph g){
+ Stack st=new Stack();
+ boolean visit[]=new boolean[g.v];
+ for(int i=0;i
+using namespace std;
+
+// Function to print all triplets in
+// given sorted array that forms AP
+void printAllAPTriplets(int arr[], int n)
+{
+ unordered_set s;
+ for (int i = 0; i < n - 1; i++)
+ {
+ for (int j = i + 1; j < n; j++)
+ {
+ // Use hash to find if there is
+ // a previous element with difference
+ // equal to arr[j] - arr[i]
+ int diff = arr[j] - arr[i];
+ if (s.find(arr[i] - diff) != s.end())
+ cout << arr[i] - diff << " " << arr[i]
+ << " " << arr[j] << endl;
+ }
+ s.insert(arr[i]);
+ }
+}
+
+// Driver code
+int main()
+{
+ int arr[] = { 2, 6, 9, 12, 17,
+ 22, 31, 32, 35, 42 };
+ int n = sizeof(arr) / sizeof(arr[0]);
+ printAllAPTriplets(arr, n);
+ return 0;
+}