Skip to content

Instantly share code, notes, and snippets.

@wildskyf
wildskyf / huffman.cpp
Last active August 29, 2015 14:20
演算法作業三 - huffman decoder
#include<iostream>
#include<vector>
#include<string>
using namespace std;
struct node
{
node * left;
node * right;
@wildskyf
wildskyf / box.cpp
Last active August 29, 2015 14:22
演算法作業四 - 裝箱問題 (2015/05/31)
#include<iostream>
#include<cstdlib>
using namespace std;
struct Box {
int side[3], cap=0;
};
int sortnum(int tmp[])
@wildskyf
wildskyf / MenuItem.java
Last active August 29, 2015 14:23
PL-FP
public class MenuItem {
private String name;
private String description;
private boolean vegetarian;
private double price;
public MenuItem(String name, String description,boolean vegetarian, double price)
{
this.name = name;
this.description = description;
@wildskyf
wildskyf / range.coffee
Last active August 29, 2015 14:27
Between a range
a = undefined
b = 13 # this could be anything you input
if b < 5
a = 1
else if b >= 5 and b < 15
a = 2
else # which is b >= 15
@wildskyf
wildskyf / CallByReference‬.js
Created August 20, 2015 10:08
CallByReference‬
var a = {};
if (a === {})
alert("yo");
else
alert("nooooo");
@wildskyf
wildskyf / getSunday.coffee
Created August 28, 2015 09:37
A function to get Sunday
###
# input: "20150806XXXXXXXX"
# output "20150802"
###
getSunday = (date) ->
if typeof(date) isnt "string"
date = date.toString()
if date.length isnt 8
#include<stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
bool first = true;
for (int times = 5 ; times > 0 ; times--) {
int data_num = 0, a = 0,b = 0;
int numArray[100];
@wildskyf
wildskyf / FBTest.cs
Created October 24, 2015 08:42
軟體工程 Kata: FizzBuzzWhizz
using NUnit.Framework;
using System;
namespace FizzBuzz {
[TestFixture]
public class FBTest {
[Test]
public void NormalNumber() {
Assert.That(MainClass.Decide(1), Is.EqualTo("1"));
Assert.That(MainClass.Decide(2), Is.EqualTo("2"));
@wildskyf
wildskyf / MAX_gate.vhd
Created October 25, 2015 07:49
[NTNU 104_1] VLSI HW1 - MAX
library IEEE;
use IEEE.STD_LOGIC_1164.all;
entity MAX_gate is
port(
A,B,C : in std_logic_vector(3 downto 0);
A_max,B_max,C_max : out Bit
);
end MAX_gate;
@wildskyf
wildskyf / Cryptanalysis.cpp
Created October 30, 2015 05:56
ACM 10008
#include <stdio.h>
#include <ctype.h>
#include <algorithm>
#include <vector>
class Alpha
{
public:
char c;
int value;