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.util.ArrayList; | |
import java.util.OptionalDouble; | |
import java.util.concurrent.ThreadLocalRandom; | |
class PaginationWastedSizeSimulation { | |
public static void main(final String[] args) { | |
//Records of random size, with avg=averageRecordSize | |
//Page of pageSize | |
//If record doesn't fit page -- it is moved to the next page, remaining space on the first page |
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
class Solution { | |
private static final char OP_CONCATENATE = ' '; | |
/** | |
* Operators, ordered by priority | |
*/ | |
private static final char[] OPERATORS = { OP_CONCATENATE, '*', '+', '-' }; | |
private static final boolean DEBUG = false; |
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.util.concurrent.ConcurrentLinkedQueue; | |
import java.util.concurrent.ThreadLocalRandom; | |
import org.junit.Ignore; | |
import org.junit.Test; | |
/** time is always in milliseconds */ | |
public class MysteriousServerTest { | |
private static final ThreadLocalRandom RND = ThreadLocalRandom.current(); |
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
public static final class Vector2D { | |
private double x; | |
private double y; | |
public Vector2D( final double x, | |
final double y ) { | |
this.x = x; | |
this.y = y; | |
} |