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
ZigZag-Encoding | |
--------------- | |
Maps negative values to positive values while going back and | |
forth (0 = 0, -1 = 1, 1 = 2, -2 = 3, 2 = 4, -3 = 5, 3 = 6 ...) | |
(i >> bitlength-1) ^ (i << 1) | |
with "i" being the number to be encoded, "^" being | |
XOR-operation and ">>" would be arithemtic shifting-operation |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <strings.h> | |
#define MAX_LEN 300001 | |
typedef struct _rope { | |
int offset, len, size; | |
char *s; | |
struct _rope *left, *right, *parent; |
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
FROM openjdk:8 | |
# Install algs4 wrapper | |
RUN mkdir -p /usr/local/algs4 \ | |
&& cd /usr/local/algs4 \ | |
&& curl -O "https://algs4.cs.princeton.edu/code/algs4.jar" \ | |
&& curl -O "https://algs4.cs.princeton.edu/linux/{javac,java}-{algs4,cos226,coursera}" \ | |
&& find ./ -regextype posix-extended -regex '.*(javac|java)-(algs4|cos226|coursera)' -exec sh -c 'chmod 755 $1 && mv $1 /usr/local/bin' - {} \; | |
# Install findbugs |