This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 5 | |
| / \ | |
| 2 6 | |
| / \ | |
| 1 3 | |
| \ | |
| 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static int[] merge(int[] a, int[] b) { | |
| int[] answer = new int[a.length + b.length]; | |
| int i = 0, j = 0, k = 0; | |
| while (i < a.length && j < b.length) | |
| { | |
| if (a[i] < b[j]) | |
| answer[k++] = a[i++]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static void rotateArr(int[][] mat, int n){ | |
| if (mat == null){ | |
| return; | |
| } | |
| for(int i = 0; i < n/2; i++){ | |
| int last = n-1-i; | |
| int len = n-1; | |
| for(int j = i; j<last;j++){ | |
| int offset = j-i; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static boolean isBST(Node head){ | |
| if(head == null){ | |
| return false; | |
| }else{ | |
| return isBST(head, Integer.MIN_INTEGER, Integer.MAX_INTEGER); | |
| } | |
| } | |
| private static boolean isBST(Node head, int min, int max){ | |
| if(head == null){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static int[] diff(Node head, int height){ | |
| if(head.left == null && head.right == null){ | |
| int[] base = new int[2]; | |
| base[0] = 0; | |
| base[1] = 0; | |
| } | |
| int[] left = new int[2]; | |
| left[0] = Integer.MAX_VALUE; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import xml.etree.ElementTree as ET | |
| from math import sqrt | |
| import json | |
| import numpy as np | |
| import pandas as pd | |
| from pandas import Series, DataFrame | |
| import os | |
| import io | |
| os.chdir('/home/edward/workspace/school/context_slices') | |
| os.getcwd() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ubuntu@ip-172-31-31-206:~$ java -jar flock.jar | |
| start | |
| Gossiping: [] | |
| Exception in thread "Thread-0" org.json.JSONException: JSONObject["id"] not found. | |
| at org.json.JSONObject.get(JSONObject.java:471) | |
| at org.json.JSONObject.getString(JSONObject.java:717) | |
| at com.tbdcomputing.network.gossip.GossipNode.<init>(GossipNode.java:45) | |
| at com.tbdcomputing.network.Flock$2.onNodeDiscovered(Flock.java:62) | |
| at com.tbdcomputing.network.discovery.NetworkDiscoveryReceiver.run(NetworkDiscoveryReceiver.java:39) | |
| at com.tbdcomputing.network.Flock$3.run(Flock.java:144) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ubuntu@ip-172-31-31-206:~$ java -jar flock.jar | |
| start | |
| Gossiping: [] | |
| {"address":"172.31.31.206","heartbeat":1458921136784,"generation_time":1458921132782,"status":"NORMAL"} | |
| Exception in thread "Thread-0" org.json.JSONException: JSONObject["id"] not found. | |
| at org.json.JSONObject.get(JSONObject.java:471) | |
| at org.json.JSONObject.getString(JSONObject.java:717) | |
| at com.tbdcomputing.network.gossip.GossipNode.<init>(GossipNode.java:46) | |
| at com.tbdcomputing.network.Flock$2.onNodeDiscovered(Flock.java:62) | |
| at com.tbdcomputing.network.discovery.NetworkDiscoveryReceiver.run(NetworkDiscoveryReceiver.java:39) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ubuntu@ip-172-31-31-206:~$ java -jar flock.jar | |
| network interface: name:eth0 (eth0) | |
| network interface: name:lo (lo) | |
| start | |
| Gossiping: [] | |
| {"address":"172.31.31.206","heartbeat":1458921462576,"generation_time":1458921455000,"status":"NORMAL"} | |
| Exception in thread "Thread-0" org.json.JSONException: JSONObject["id"] not found. | |
| at org.json.JSONObject.get(JSONObject.java:471) | |
| at org.json.JSONObject.getString(JSONObject.java:717) | |
| at com.tbdcomputing.network.gossip.GossipNode.<init>(GossipNode.java:46) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 54.165.12.246 | |
| 54.173.172.71 | |
| 54.175.78.8 | |
| 54.165.227.128 |