Skip to content

Instantly share code, notes, and snippets.

@guojh
guojh / fpl_Guesser.hs
Last active December 16, 2015 01:19
Homework of Foundations for Programming Languages http://staff.ustc.edu.cn/~yuzhang/fpl/
module Main where
import Random
import System.IO
-- To make an executable called "Guesser"
-- >ghc --make Guesser.hs
-- Note that the function
-- getRandom :: (Int, Int) -> IO Int
-- is defined in the module Random
{
server: {
name: 's',
main_domain_name: 's',
net: {
ip_list: [
'...'
]
},
storate: {
@guojh
guojh / binary-search-tree.c
Created December 3, 2012 05:29
binary search tree
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <ctype.h>
typedef struct bst *bst_t;
struct bst {
char name;
int index;
@guojh
guojh / huffman.c
Created December 3, 2012 05:21
huffman encode/decode program
#define __BSD_SOURCE
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <endian.h>
typedef struct list_node
{
struct list_node *next;
} list_node, *plist;
plist find_circle(plist head)
{
int count, scount, ncount;