/*
Input two integers M and N. Find all possible ways that the sum of numbers chosen from 1, 2,3,...N equals M. Print all possible combinations.
*/
Combination of letters
Posted at
7/13/2011 09:02:00 AM
// List all combinations of letters in a string. Suppose no letter is repeated.
// traverse letters from the first one to the last one.
// combination[ ] is used to save the result of each combination.
// layer indicates the number of letters in the combination, also it tells you
// the position of the newly visited letter in combination[ ]
// layer increases by one in each recursion
// traverse letters from the first one to the last one.
// combination[ ] is used to save the result of each combination.
// layer indicates the number of letters in the combination, also it tells you
// the position of the newly visited letter in combination[ ]
// layer increases by one in each recursion
Sieve of Eratosthen algorithm
Posted at
7/06/2011 10:51:00 AM
Sieve of Eratosthen algorithm is used to find primes.
The following codes(modified) are from Algorithms in C++ and Core Java Volume I.
The following codes(modified) are from Algorithms in C++ and Core Java Volume I.
Palindrome
Posted at
7/05/2011 09:09:00 PM
The following program determines if a given string is a palindrome.
Another way to do this is first to copy the string to another char[] and remove the non- alphabet characters from the string. Then copy it to the third char array and reverse the order of the string . Finally compare the two strings.
Another way to do this is first to copy the string to another char[] and remove the non- alphabet characters from the string. Then copy it to the third char array and reverse the order of the string . Finally compare the two strings.
[C++] An implementation of atoi
Posted at
7/05/2011 06:07:00 PM
This is an implementation of atoi function I wrote. Seems it works.
Setup MySql on Ubuntu 11.04
Posted at
6/23/2011 11:06:00 AM
Install MySQL
sudo apt-get install mysql-server-5.1 sudo mysql_install_db sudo mysql_secure_installationThen download and install JDBC (connector/J) driver.
MySQL Programming in Java
Posted at
6/23/2011 11:05:00 AM
Connecting to Database:
String url = "jdbc:mysql://hostname:portNumber/databaseName"; String username = "dbuser"; String password = "secret"; Connection conn = DriverManager.getConnection(url, username, password);
Setup MySQL on Fedora 15
Posted at
6/23/2011 11:04:00 AM
yum install mysql-serverStart MySQL server and autostart on boot:
/etc/init.d/mysqld start ## use restart after update ##OR## service mysqld start ## use restart after update chkconfig --levels 235 mysqld on
Subscribe to:
Posts (Atom)