Skip to content

Instantly share code, notes, and snippets.

View AdelinGhanaem's full-sized avatar
🎯
Focusing

Adelin AdelinGhanaem

🎯
Focusing
  • Veliko Tarnovo,Bulgaria.
View GitHub Profile
public class InOrder {
public void traverse(Node root) {
if (root == null) {
return;
}
traverse(root.getLeft());
System.out.print(root.getValue()+" > ");
traverse(root.getRight());
}
public class PostOrderTraversal {
public void traverse(Node root) {
if (root == null) {
return;
}
traverse(root.getLeft());
traverse(root.getRight());
System.out.print(root.getValue()+" > ");
}
public class PreOrder {
public void traverse(Node root) {
if (root == null) {
return;
}
System.out.print(root.getValue()+" > ");
traverse(root.getLeft());
traverse(root.getRight());
}
import static com.trees.SimpleTreeFactory.*;
public class TreeHigh {
public int find(Node root) {
if (root == null)
return 0;
return 1 + Math.max(find(root.getLeft()), find(root.getRight()));
}
public static void main(String[] args) {
public class SimpleTreeFactory {
public static Node get() {
//the left part of the tree
Node leaf7 = new Node(null, null, 7);
Node leaf0 = new Node(null, null, 0);
Node node5 = new Node(leaf7, leaf0, 5);
package com;
import java.lang.reflect.Field;
/**
* Created by adelin.ghanayem@cayetanogaming.com on 2/17/16.
*/
public class MakeImmutableMutable {
package com;
import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;
import java.util.function.Consumer;
/**
* Created by adelin.ghanayem@cayetanogaming.com on 2/17/16.
package com;
/**
* Created by adelin.ghanayem@cayetanogaming.com on 2/16/16.
*/
public final class User {
private final String name;
private final boolean isActive;
package com;
/**
* Created by adelin.ghanayem@cayetanogaming.com on 2/16/16.
*/
public class Address {
private int number;
private String address;
public class DefaultCassandraDriver {
//only one session per key space
// we may provide a Map of Keyspace and their respective sessions !
private static Session SESSION;
public DefaultCassandraDriver(String clusterName, String... contactPoints) {
createSession(Cluster.builder().withClusterName(clusterName).addContactPoints(contactPoints).build());
}