### Coin Change Problem

Given $$N$$ denominations,how can a given amount of money $$V$$ be made with the least number of coins? The most intuitive solution is greedy algorithm: sort the denominations, try the largest denominations lower than the value every time, and decrease the value with the denominations picked in every iteration. Repeat this process until the value reduces to 0. This greedy strategy works for the US (and most other) coin systems, However, it is not a general solution to all denomincations. For example, if the coin denominations were 1, 3 and 4, then to make 6, the greedy algorithm would choose three coins (4,1,1) whereas the optimal solution is two coins (3,3).

### Check Soduku Solution

The objective of Soduku game is to fill a $$9 \times 9$$ grid with digits so that each column, each row, and each of the nine $$3 \times 3$$ sub-grids that compose the grid (also called “boxes”, “blocks”, “regions”, or “sub-squares”) contains all of the digits from 1 to 9. A solved Soduku game is like:

### Least Recently Used(LRU) Cache

According to LeetCode:

### Binary Tree Operations(I)

This is the first article on binary tree operations. For other topics on binary tree, please refer to:

### Action Recognition with Fisher Vectors

This is a summary of doing human action recognition using Fisher Vector with (Improved) Dense Trjectory Features(DTF) and STIP features on UCF 101 dataset(http://crcv.ucf.edu/data/UCF101.php). In the STIP features, two low-level visual features HOG and HOF are integrated, with dimensions 72 and 90 respectively. The (improved) DTF employ more features(TR, HOG, HOF and MBHx/MBHy) with longer dimensions.

### C++ Code to Print Pascal Triangle

Printing Pascal Triangle seems like an easy problem, however, it is not that easy to print a good-looking Pascal Triangle.

To print the Pascal Triangle, for each line, first print spaces to the left of numbers, and then print digit numbers.

To calculate Pascal numbers, two assays can be used: one array to store numbers of above line, the other array to store numbers of this line. The first line has 1 number(1), the second lien has 2 numbers(1 1), the third line has three numbers(1 2 1) and so on.

To make the Pascal Triangle more readable, print spaces between two neighbor  numbers in the same line.


// Pascal triangle
#include <iostream>
#include <iomanip>
#include <cstring>
using namespace std;

const int WIDTH=7;
int main()
{
int* oldarr=new int[WIDTH]; // store numbers of above row
int* newarr=new int[WIDTH]; // store numbers of current row

for(int i=0;i<WIDTH;++i) // cntrol row counting
{
for(int j=0;j<WIDTH-i-1;++j) // left space
cout << setw(2) << " ";

// set default boundary numbers
newarr[0]=1;
if(i<=1)
newarr[i]=1;

if(i<=2)
{
for(int k=1;k<i;++k)
newarr[k]=oldarr[k-1]+oldarr[k];
}
memcpy(oldarr,newarr,sizeof(int)*WIDTH);

// Print the middle part
int idx=0;
int flag=(WIDTH-i-1)%2;
for(int j=WIDTH-i-1;j<WIDTH+i;++j)
{
if(j%2==flag)
{
cout << setw(2) << newarr[idx++];
} else {
cout << setw(2) << " ";
}
}

//for(int j=WIDTH+i;j&lt;WIDTH;++j) // Print right space, if you like
//	cout&lt;&lt;setw(4)&lt;&lt;&quot; &quot;;

cout << endl;
}

delete [] oldarr;
delete [] newarr;

return 0;
}


The output looks like:

             1
1   1
1   2   1
1   3   3   1
1   4   6   4   1
1   5  10  10   5   1
1   6  15  20  15   6   1