Thursday, March 18, 2010

OOP344 Challenge on March 18th

Challenge: write the pntBits() function in one line.
Here is my solution.

Saturday, March 13, 2010

A class to perform like Linked list

Linked list is a common data structure type. FIFO (First In First Out) is its principle. Click here to see more about linked list.

Here is my solution:
A class named queue that can perform like a doubly-linked list.

It's really a basic version that only works for int right now, but it can be improved to associate with other data types and derived data types.

qsort() practice

The practice is actually a question from my OOP344 TEST1. Requirement is as follows:
$ Q2 hello i am writing a text
a
am
hello
i
text
writing
$_
Write a program to produce the output above, using qsort() fucntion.

The solution is here. It's really a simple function, however I didn't do it completely correct during the exam. I think there are two reasons: first, I am not familiar with the qsort() function, though the spec is given; second, I didn't practice how to pass a function pointer as a parameter to a function.