OtakuÂçÂð

ÝÄ·Þ²ÃÆþ¹á¹Á²ÈÎ¢í­¶¨Ðò ÑÈTL

2007 first blog

2007-01-01 01:11:36 | üοÍÀ±¿Í4éËÇ·Æü¾ï
ÇòÌÜÇòÌÜËôÅþλÆóÎíÎí¼·
´ÔÀ§´êÀ¤³¦ÏÂÊ¿
ÇòÌÜÇòÌܺƲáÆóÎíÎíȬ
¥³¥á¥ó¥È (0) |  ¥È¥é¥Ã¥¯¥Ð¥Ã¥¯ (0) | 

processing

2006-12-13 16:02:22 | Cityu
size(300,300);
smooth();

ellipseMode(CENTER_RADIUS);
stroke(50,50,50);
fill(0,0,200);
ellipse(150,150,100,100); //face
fill(255,255,255);
ellipse(150,170,80,80); //face
ellipse(110,120,30,30); //eye
fill(0,0,0);
ellipse(110,120,5,5); //eye
fill(255,255,255);
ellipse(190,120,30,30); //eye
fill(0,0,0);
ellipse(190,120,5,5); //eye
line(150,150,150,220); //face
fill(255,0,0);
ellipse(150,150,10,10); //face
line(120,170,80,160); //face
line(120,180,80,180); //face
line(120,190,80,200); //face
line(180,170,220,160); //face
line(180,180,220,180); //face
line(180,190,220,200); //face
line(150,220,130,210); //face
line(150,220,170,210); //face
// end of doraemon
¥³¥á¥ó¥È (0) |  ¥È¥é¥Ã¥¯¥Ð¥Ã¥¯ (3) | 

ÕïÀÐ

2006-12-11 23:56:19 | üοÍÀ±¿Í4éËÇ·Æü¾ï
̵¿ÍÃÎÚüending - ÕïÀÐ

½¢»»²æÌä¸áÌëŪŷ¶õ¡¤ÌéÂþ´Ç¸«À±À±ÉÔÄäÁ®à£¡£¿ÊÆþ內¿´¡¤ÍÏÀ®Î»üŪ¸ÐÇñ¡¤²æÌéÂþǽî®ÇÈÃàή¡£

Å·»ÈÀ§ÈÝÐòºÆ²óƬ´Ç²æ¡©À§ÈÝÐòºÆ½¼Þà²æÅª¿´Ã桩¨ÕòÐÔÎ×ŪÅßÉ÷¿áư³¤Ï²¡¤´­²æ¿ÊÆþüî°ÅÇ·Ãæ¡£

ǡƱÑÖ²ôÈ̸ϰàŪÒÖâÈ¡¤²æÁ²Á²Ä¹Âç¡£ÝóÍ­¿Í´ºÀܶᡤ»¶â¤°Û½­ÅªÕïÀС£
¥³¥á¥ó¥È (0) |  ¥È¥é¥Ã¥¯¥Ð¥Ã¥¯ (0) | 

merge sort

2006-12-04 23:47:49 | Cityu
#include <iostream>

using namespace std;
void mergesort(int [],int,int);
int* merge(int list[], int , int);
void main(){
int size,*list=NULL,i;
cout << "Input number of elements:\n";
cin >> size;
list = new int [size];
cout <<"Input elements of the list:\n";
for(i=0;i<size;i++)> *(list+i);
mergesort(list,0,size-1);
cout <<"The sorted list:\n";
for(i=0;i<size;i++) }

int* merge(int list[],int low,int high){ //merge two sorted list
int *buffer =new int[(high-low)+1],mid = (low+high)/2,l1=low,l2 = mid+1,k=0;
/*
**********************************
precondition :this function can only merge two sorted list ,i.e 1 ,3 5;2 ,4 6
*********************************
look at l1 & l2 ,if l1 > l2 ,copy bufer[l1] to result[k] ,k(buffer index)++,l1++
else if l2 > l1 copy bufer[l2] to result[k] ,k,l2++
if l1 ends before l2 ,copy remained l2 to result[k]
AND rest
*/
while(l1 <= mid && l2 <= high){
if(list[l1] <= list[l2])
buffer[k++] = list[l1++];
else
buffer[k++] = list[l2++];
}
// copy the rest ,l1 ends first ,copy remained l2 to buffer
if(l1 > mid)
while(l2 <= high)
buffer[k++] = list[l2++];
else
while(l1 <= mid)
buffer[k++]=list[l1++];

return buffer;
}

void mergesort (int a[], int low, int high){
// this algorithm sorts the portion of array a with index
// from low to high, inclusive.
if (low <high) { // recursively sort a[low..mid]
mergesort(a,low,mid);
// recursively sort a[mid+1..high]
mergesort(a,mid+1,high);
// merge the two sorted lists into buffer[]
buffer = merge(a,low,high);
// copy buffer[] into a[low..high]
for(int i=low,j=0;i<=high;i++,j++)
a[i] = buffer[j];
delete [] buffer;

}
}
¥³¥á¥ó¥È (0) |  ¥È¥é¥Ã¥¯¥Ð¥Ã¥¯ (0) | 

²¼ºÜyou tube ±ÆÊÒŪÊýË¡

2006-12-04 23:21:55 | üοÍÀ±¿Í4éËÇ·Æü¾ï
http://www.cuhkacs.org/~little4/Bo-Blog/index.php?job=art&articleid=a_20060603_014250
¥³¥á¥ó¥È (1) |  ¥È¥é¥Ã¥¯¥Ð¥Ã¥¯ (0) |