2007年11月17日

摘要: 最近我在想一个系列的构思,可能已经有人想过了或者已经出现类似的产品,只是随便想到的,我的构思大致是这样…… 阅读全文

posted @ 2007-11-17 08:03 QT_pixy 阅读(346) 评论(1) 推荐(0)

摘要: 关于Operating System建立thread的程序,多个thread共享一个circular buffer,按照一定的顺序对这个buffer进行操作。因为每个thread写入之后要sleep一段时间,然后把CPU分配到其他thread上。我这个程序可以正确运行,但是如果thread非常多,共同操作一个buffer,系统运行速度就会很慢。可能是因为CPU在多个thread之上不停的转换造成的。 阅读全文

posted @ 2007-11-17 05:07 QT_pixy 阅读(850) 评论(4) 推荐(0)

摘要: 这个程序需要建立多个thread,然后使用shared memory来进行数据共享。This program takes 3 command line arguments; the first two are expected to be non-negative integers, the third, the name of a file (the file may or may not exist). 阅读全文

posted @ 2007-11-17 04:57 QT_pixy 阅读(440) 评论(0) 推荐(0)

摘要: 学习Operating System的底层机制对于进行底层开发的人员来说很重要,下面这个简单的程序是关于fork process的练习。Write a C program that takes 3 command line arguments and treats the first 2 like commands and the 3rd as a filename. 阅读全文

posted @ 2007-11-17 04:48 QT_pixy 阅读(501) 评论(0) 推荐(0)

摘要: 关于字典的程序,可以在字典中增加单词,每个单词可以有最多10个翻译,可以从字典中删除单词。这个程序的特点就是使用malloc操作内存。大家知道C语言中操作内存是很高效但很危险的,很容易出现内存泄露(memory leak).这个程序需要用struc来在内存中建立结构。如果要练习对内存进行操作和struc的使用,这个程序是非常好的练习题目。最后,我使用unix下的内存检测工具来检查是否存在错误的内存操作。好的程序是能够合理的尽量节约的使用内存,所以这个程序限制了内存的最大使用量。 阅读全文

posted @ 2007-11-17 04:29 QT_pixy 阅读(673) 评论(0) 推荐(0)

摘要: 这个程序功能很简单,但具体要求非常多。考虑到程序的严谨性所以要针对所有可能出现的情况进行处理。第一次进行test cases测试的时候一大半的test cases都没有通过,进行分析修改后以下程序通过所有的test cases. 因为限制只能用部分C的function,所以要求较高的逻辑思维能力。 阅读全文

posted @ 2007-11-17 04:04 QT_pixy 阅读(317) 评论(0) 推荐(0)

摘要: Square Root Function: This function returns the square root of a number passed in $f0. Returned number is stored in f0. This method works recursively without need for storing previous variables. 阅读全文

posted @ 2007-11-17 03:53 QT_pixy 阅读(2949) 评论(0) 推荐(0)

摘要: This program reads a valid date (3 integers being date (d), month (m), year using the Zeller's algorithm described below: 阅读全文

posted @ 2007-11-17 03:50 QT_pixy 阅读(407) 评论(0) 推荐(0)

摘要: When you run your Java programs which contain one or more classes, you may get some strange problems or errors. Not all errors are made by syntax fault. 阅读全文

posted @ 2007-11-17 03:34 QT_pixy 阅读(224) 评论(0) 推荐(0)


2007年2月14日

摘要: 理解这些对于pointer的使用非常重要。C比JAVA难就难在语法简单,越是简单的语法就越蕴涵着千变万化,就好象围棋一样,规则简单却蕴涵着很深的棋道。只有彻底理解了pointer才能熟练掌握它的千变万化。 阅读全文

posted @ 2007-02-14 04:29 QT_pixy 阅读(641) 评论(0) 推荐(0)


2007年2月13日

摘要: 一个逻辑性高的程序,如果有一个地方写错了,那很可能整个程序都不能正常运行。相比之下,逻辑性的错误倒是比较容易发现,最让人头疼的就是不小心犯下的小错误 阅读全文

posted @ 2007-02-13 07:17 QT_pixy 阅读(312) 评论(1) 推荐(0)

摘要: A deque is a double-ended queue that supports insertion and deletion at both the front and the rear of the queue. Implement the deque ADT using a circular array. Extend the array by doubling its capacity when a new element is inserted into a full deque. Use an initial array size of 8. Shrink the array by half the current size N when the number of elements in the deque falls below N/4 (but the minimum capacity should be 8, the INITIAL_CAPACITY). 阅读全文

posted @ 2007-02-13 06:55 QT_pixy 阅读(1119) 评论(4) 推荐(0)


2007年2月10日

摘要: Implement the queue ADT using only stacks and the methods pop(), push() and empty() of the java.util.Stack class. In Stack, We pop the element on the top of stack. In queue, we "pop" the front element which is inserted in queue first. This is the only difference between these two structure. Now we can use pop() method in Stack to do deletion in Queue. 阅读全文

posted @ 2007-02-10 22:43 QT_pixy 阅读(885) 评论(2) 推荐(0)


2007年2月8日

摘要: MergeSort, I didnot use median of 3 method to choose pivot, instead, I use center = (left + right)/2 as a pivot to partition the array. Note, when left + CUTOFF = right, which means there is only CUTOFF(5) elements in the subarray. Then we do not continue the MergeSort, we change to use insertion sort since it is more efficient than MergeSort when we have a small array. 阅读全文

posted @ 2007-02-08 10:42 QT_pixy 阅读(582) 评论(0) 推荐(0)

摘要: Implement the deque(double-ended queue) ADT using a doubly linked list 阅读全文

posted @ 2007-02-08 03:16 QT_pixy 阅读(4204) 评论(0) 推荐(0)


2007年2月6日

摘要: Find the Kth smallest element 阅读全文

posted @ 2007-02-06 22:59 QT_pixy 阅读(978) 评论(0) 推荐(0)

摘要: quicksort 阅读全文

posted @ 2007-02-06 12:49 QT_pixy 阅读(573) 评论(0) 推荐(0)


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3