Skip to content

Instantly share code, notes, and snippets.

View chaoxu's full-sized avatar
😀

Chao Xu chaoxu

😀
  • University of Electronic Science and Technology of China
  • Chengdu, Sichuan, China
View GitHub Profile
U←⎕A
L←⎕UCS 32+⎕UCS U
Count←{+/⍵⍷⍺}
MostFrequent←{
kmers←∪⍵,/⍺
counts←(⊂⍺)Count¨kmers
(counts=⌈/counts)/kmers
}
@chaoxu
chaoxu / Markdown.tmLanguage
Last active August 29, 2015 14:05
For sublime text 3, make Markdown also highlight latex codes in between $, $$, \[
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array>
<string>mdown</string>
<string>markdown</string>
<string>markdn</string>
<string>md</string>
@chaoxu
chaoxu / DecomposableDequeue.hs
Last active August 29, 2015 14:09
Decomposable Dequeue
module DecomposableDequeue (DecomposableDequeue, emptyDecomposableDequeue, pushFront, pushBack, popFront, popBack, measure) where
import qualified Data.Dequeue as D
emptyDecomposableDequeue :: (x->f->f)->f->(b->x->b)->b->(f->b->y)->DecomposableDequeue x f b y
emptyDecomposableDequeue fpush fid bpush bid comb = DecomposableDequeue comb (flip fpush) bpush fid bid D.empty [] []
measure :: DecomposableDequeue x f b y -> y
measure deq = combine deq (peek (idf deq) (frontStack deq)) (peek (idb deq) (backStack deq))
where peek a b
| null b = a
buildSegment[a_, xs_, x_] :=
If[Length[xs] == 1, {},
Join[{ { xs[[1]] + (x - a)*Sign[xs[[2]] - xs[[1]]],
a <= x <= a + Abs[xs[[1]] - xs[[2]]]} },
buildSegment[ a + Abs[xs[[1]] - xs[[2]]], Rest[xs], x]] ]
Curve[xs_, x_] := Piecewise[buildSegment[0, xs, x]]
MaxLength[xs_] :=
Sum[ Abs[xs[[i]] - xs[[i + 1]]], {i, 1, Length[xs] - 1}]
FreeDiagram[xs_, ys_, epsilon_] :=
RegionPlot[
@chaoxu
chaoxu / testgust
Created January 26, 2015 04:32
min-cost flow bounded treewidth
<p>We have a graph <span class="MathJax_Preview"></span><span class="MathJax" id="MathJax-Element-1-Frame" role="textbox" aria-readonly="true"><nobr><span class="math" id="MathJax-Span-1" style="width: 5.123em; display: inline-block;"><span style="display: inline-block; position: relative; width: 4.447em; height: 0px; font-size: 115%;"><span style="position: absolute; clip: rect(1.693em 1000.002em 2.853em -0.384em); top: -2.51em; left: 0.002em;"><span class="mrow" id="MathJax-Span-2"><span class="mi" id="MathJax-Span-3" style="font-family: STIXGeneral-Italic;">G</span><span class="mo" id="MathJax-Span-4" style="font-family: STIXGeneral-Regular; padding-left: 0.292em;">=</span><span class="mo" id="MathJax-Span-5" style="font-family: STIXGeneral-Regular; padding-left: 0.292em;">(</span><span class="mi" id="MathJax-Span-6" style="font-family: STIXGeneral-Italic;">V<span style="display: inline-block; overflow: hidden; height: 1px; width: 0.099em;"></span></span><span class="mo" id="MathJax-Span-7" style="font-fam
80
18 21 26 36 37
9 16 17 26 27 34 35 37 38 39
1 20 26 31 38
2 3 14 18 21 25 32 34 35 37 38
1 3 9 10 17 19 23 25 31
1 4 12 14 34
1 2 4 8 10 11 15 17 18 37 38
22 24 25 32 35 37
7 13 14 23 28 32 33 38
import java.util.*;
class BitArray implements Comparable<BitArray> {
public int size;
public int id;
public boolean[] a;
public ArrayList<Integer> e;
public int size(){
return size;
}
public BitArray(int i, int k){
#include <iostream>
#include <bitset>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
using namespace std;
const int N=1000;
int counter=0;
int ub;
63
25
5 0 1 2 3 4
8 5 6 7 8 9 10 11 12
6 0 13 14 15 16 17
5 5 18 19 20 21
4 22 23 24 25
4 22 26 27 28
4 18 29 30 31
4 32 33 34 35
import java.util.*;
public class msc{
public static int ub;
public static ArrayList<Integer> result;
public static void main(String[] args){
Scanner in=new Scanner(System.in);
int e = in.nextInt();
int n = in.nextInt();
in.nextLine();