The formula : To move n plates, you have to move at least (2ˆn – 1) times
Filed under: Tips | Tagged: Hanoi_Tower | Leave a Comment »
The formula : To move n plates, you have to move at least (2ˆn – 1) times
Filed under: Tips | Tagged: Hanoi_Tower | Leave a Comment »
Factorial
int fact(int n)
{
if(n == 0)
return (1);
else
return (n * fact(n-1));
}
Filed under: Tips | Tagged: recursion | Leave a Comment »
#include <string> strrev( ) // To reverse a string
♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ ♦ [...]
Filed under: Tips | Tagged: c++ function | Leave a Comment »
Bubble_sort
#include <algorithm>
// bubble_sort(array, 0, ARRAY_SIZE – 1);
void bubble_sort(int ar[], int start, int end)
{
for(int i = end; i > start; i–)
for(int j = start; j < i; j++)
if(ar[j] > [...]
Filed under: Tips | Tagged: sort | Leave a Comment »
The way to post code in wordpress is as follows:
wrap your code in the following tags
[sourcecode language='java']…[/sourcecode]
And the presentation would be like this:
// Paste your code here
But be careful /0 won’t be presented and certain symbols will show smileys !!
Filed under: Tips | Tagged: post code | Leave a Comment »