Very basic hashtable

This is only a very basic hashtable
I use half an hour to write it(such a easy program takes me so long)
The hash function of string is simply sum all of the charactors up and times a prime number
This program is used to calculate how many times of every input string appears
The structure of this hashtable is like this:


I finished merge sort, heap sort. If I leave quicksort along, he must be very upset.
So… Quicksort, here we go.
Quicksort, not only quick, but also … quick.
The first quick means it runs quickly, the second one is it writes short and quick.
Here is my code

void quicksort(int *line, int from, int to){
if(from == to) return ;
int pivot = line[to - 1],now = from;
for(int i = from;i < to - 1;++ i)
if(line[i] < pivot) swap(line[i],line[now ++]);
swap(line[now],line[to - 1]);
quicksort(line, from, now);
quicksort(line, now + 1, to);


Heap sort? What? You choose this?
I don’t know why I choose heapsort. Maybe I just want to practise how to write something about heap.
If you want to know how it works, go to Wiki, or Baidu, or Google.
It’s just my implement.
We can see that heapsort may have more actions compared with quicksort. But heapsort is always $O(n * log_2n)$, while quicksort may cause a $O(n^2)$. Especially I’m always in bad luck. T.T
Here is my code:

Distance Calculator GUI

Everyone want to calculate the distance between his Goddess and himself. This calculator can meet your need!
This is the first time that I use Python to generate a calculator.

This program is used to get a GUI software for a edit distance calculator

Sort List use merge sort

Why you are so sad? Just because you can not sort a list?
If someone want you to sort a list, what will you do? quicksort? No.
Merge sort is your choose! How much do you think a merge sort will cost? $O(n^2)$ ? $O(n^3)$ ? No!
It ONLY take you $O(n * log_2n)$! Buy now, you can get a input part freely!

Simple Network

Author: Song Li
Download Project


This program is used to transform files from client to server, the server will run the received code and return the answer to the client. The client part and the server part are combined to a single program. Using “fork()” function to make them work separately.


Author: Song Li

This program is use to do text format things. Users can use this program to limit the width of every line into a particular length and can uniform every blanks.

Maximal Square

Given a 2D binary matrix filled with 0’s and 1’s, find the largest square containing all 1’s and return its area.

For example, given the following matrix:

1 0 1 0 0
1 0 1 1 1
1 1 1 1 1
1 0 0 1 0
Return 4