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
from heapq import heapify, heappop, heappush | |
from itertools import islice | |
from sys import maxsize | |
# サンプルデータ | |
pq0 = [(1, "a"), (2, "b"), (3, "f")] | |
pq1 = [(1, "c"), (2, "d"), (3, "g")] | |
heapify(pq0) | |
heapify(pq1) |
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 groovy.transform.CompileStatic | |
import org.junit.Test | |
@CompileStatic | |
class Benchmark { | |
@Test | |
void test1() { | |
int[] ary = new int[1024 * 1024] | |
for (int i = 0; i < ary.length; i++) { | |
ary[i] = 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
#include <queue> | |
#include <iostream> | |
#include <cstdlib> | |
#include <ctime> | |
using namespace std; | |
void benchmark(int len) | |
{ | |
priority_queue<int> q; |
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
<!DOCTYPE html> | |
<html> | |
<body> | |
<p><canvas id="canvas" style="border:2px solid black;" width="200" height="200"></canvas> | |
<script> | |
var canvas = document.getElementById("canvas"); | |
var ctx = canvas.getContext("2d"); | |
var data = "<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'>" + | |
"<foreignObject width='100%' height='100%'>" + | |
"<div xmlns='http://www.w3.org/1999/xhtml' style='font-size:40px'>" + |
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 java.security.MessageDigest; | |
import java.security.NoSuchAlgorithmException; | |
public class MD5Utils { | |
public static String convert(String s) { | |
try { | |
// Create MD5 Hash | |
MessageDigest digest = MessageDigest.getInstance("MD5"); | |
digest.update(s.getBytes()); | |
byte messageDigest[] = digest.digest(); |
NewerOlder