Skip to content

Instantly share code, notes, and snippets.

View skyzh's full-sized avatar
🐱
working

Alex Chi Z. skyzh

🐱
working
View GitHub Profile
@skyzh
skyzh / Compressor.cpp
Last active August 29, 2015 14:07
Huffman Tree Encoding (Compressor)
//Drag your file on the excutive file
//C++
#include <algorithm>
#include <map>
#include <functional>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
@skyzh
skyzh / ModCalculator.cpp
Last active August 29, 2015 14:07
Modular Arithmetic Calculator
//Modular Arithmetic Calculator(According to Fermat's little theorem)
//So some of the calculations can not be done.
//Also can be used as Expression Calculator if change "ModNumber" to INT_MAX in CalculationElement Class
#include <algorithm>
#include <stack>
#include <list>
#include <vector>
#include <map>
@skyzh
skyzh / Prim.cpp
Last active August 29, 2015 14:07
Minimum spanning tree
//Prim - Minimum spanning tree
#include<iostream>
#include<algorithm>
#include<functional>
#include<set>
#include<vector>
#include<queue>
#include<cstring>
@skyzh
skyzh / Splay.cpp
Last active August 29, 2015 14:18
Splay - An Array mainly used to "Flip"
//Splay Tree
//An array mainly used to do "Flip" action
//You can build Splay Tree by running 'SplayTree::Create(TreeSize)', and then you'll have an array with numbers '1 2 3 ... n'
//You can flip a block of numbers by running 'Tree->Flip(L,R)'. Notice, L and R are counted from 0.
//You can print all the numbers in Tree by running 'Tree->TryPrint()'. Also you can get the Nth number by running 'Tree->FindNth(pos)'
//This is an incomplete example.
#include <iostream>
#include <algorithm>
#include <vector>
@skyzh
skyzh / BigNumberCalculation.cpp
Created April 4, 2015 11:15
Big Number Calculation
//Big Number Calculation
//You can Add, Subtract or Multiply a BigNumber.
//What's more, all the calculations are done in base 10000 system. SPEED UP!!!
//You can adjust base system by changing NUM_PER_BIT and NUM_PER_BIT_BIT.
#include<iostream>
#include<sstream>
#include<iomanip>
#include<string>
#include<cstring>
@skyzh
skyzh / NamespaceCombination.cpp
Created April 4, 2015 11:41
Namespace Combination
#include<iostream>
#include<cstdlib>
namespace Test
{
class TB;
class TA
{
public:
TB *b;
@skyzh
skyzh / SumCalc.cpp
Created May 16, 2015 09:15
Unknown Problem
// Input: N, Y ---> Output Several Numbers' Sum == Y
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstring>
#include <cstdlib>
using namespace std;
@skyzh
skyzh / CloudOJ - Database.md
Last active August 29, 2015 14:27
CloudOJ v2 Database

User

  • TABLE User
  • TABLE UserProfile
  • TABLE Userlevel
  • TABLE Admingroup

Problem

  • TABLE Problem
@skyzh
skyzh / ums - Database.md
Last active August 29, 2015 14:27
ums Database

μms Database

  • TABLE User
  • TABLE UserProfile
  • TABLE UserLog
  • TABLE Session
  • TABLE CAPTCHA
  • TABLE MailQueue
  • TABLE DirectMessage
  • TABLE Application
@skyzh
skyzh / space.cpp
Created September 17, 2015 11:11
Read Space in string
for(int i = 0, j; i < str.length(); i = j + 1) {
for(j = i; j != ' ' && j < str.length(); ++j) {
}
}