This file contains 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
target/release - [master] » ./pragprog | |
Using Bubble Sort | |
10000, 143 | |
20000, 591 | |
30000, 1308 | |
40000, 2343 | |
50000, 3662 | |
60000, 5691 | |
70000, 7559 |
This file contains 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
boolean isAnagram( String s1, String s2) { | |
if (s1.length() != s2.length()) return false; | |
int x = 0; | |
for (int i = 0; i<s1.length(); i++) { | |
x ^= s1.charAt(i) ^ s2.charAt(i); | |
} | |
return x == 0; | |
} |
This file contains 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
(defn _midpoint [vec] | |
(quot (+ (.start vec) (.end vec)) 2)) | |
(defn _chop [item list] | |
(cond | |
(empty? list) -1 | |
(= 1 (count list) ) (if (= item (first list)) (.start list) -1) | |
:else (let [mid (_midpoint list)] | |
(let [val (get (.v list) mid)] | |
(cond |
This file contains 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
# | |
# quick command line alias to do something to each directory under | |
# the current path | |
# | |
# For example: | |
# | |
# > eachDir "git status" | |
# | |
func_Each_dir() { |
This file contains 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 java.io.*; | |
import java.util.*; | |
import java.util.stream.*; | |
public class Solution { | |
private static final String INSERT = "Insert"; | |
private static final String DELETE = "Delete"; | |
public static void main(String[] args) { | |
Scanner scanner = new Scanner(System.in); |
This file contains 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
/* | |
Compare two linked lists A and B | |
Return 1 if they are identical and 0 if they are not. | |
Node is defined as | |
struct Node | |
{ | |
int data; | |
struct Node *next; | |
} | |
*/ |
This file contains 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
# | |
# This is the (brute force) way I'd thought to do it | |
eval "$(docker-machine env default)" | |
# get the IP address of our docker-machine, | |
# so we can add it to no_proxy below | |
DOCKER_IP=$(echo $DOCKER_HOST | sed 's#tcp://##' | sed 's#:.*##') | |
export no_proxy=lexmark.com,localhost,pvi.com,$DOCKER_IP | |
## this is the actual way to do it |
This file contains 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
"So, why'd we choose technology 'X'?" | |
"Look, we can do this the easy way or the hard way. We can go through a drawn-out, | |
two-week process and finally decide to use 'X'. Or, we can just use 'X'." |
This file contains 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
a.out: | |
(__TEXT,__text) section | |
_main: | |
0000000100000ea0 pushq %rbp | |
0000000100000ea1 movq %rsp, %rbp | |
0000000100000ea4 pushq %rbx | |
0000000100000ea5 pushq %rax | |
0000000100000ea6 leaq 0xdd(%rip), %rbx | |
0000000100000ead movl $0x5, %esi | |
0000000100000eb2 movl $0x9, %edx |
This file contains 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
(__TEXT,__text) section | |
_main: | |
0000000100000ef0 pushq %rbp | |
0000000100000ef1 movq %rsp, %rbp | |
0000000100000ef4 subq $0x20, %rsp | |
0000000100000ef8 movl $0x0, -0x4(%rbp) | |
0000000100000eff movl %edi, -0x8(%rbp) | |
0000000100000f02 movq %rsi, -0x10(%rbp) | |
0000000100000f06 movl $0x5, -0x14(%rbp) | |
0000000100000f0d movl $0xa, -0x18(%rbp) |
NewerOlder