void putlong(long n)
{
if(n == 0) // special case
{
putchar('0');
return;
}
else
if(n 0) // if number is negative, print - sign and continue as if it
is a positive number
putchar('-'), n = -n;
int arr[30];
int arr_cnt = 0;
while(n)
{
arr[arr_cnt++]
assuming the numbers are n-bit numbers,
1. have an array, arr, of n elements, initialize all elements with 0.
2. traverse the input array
3. if input[i] is a power of 2,
arr[ lg(input[i]) ] ++; // where lg is logarithm to the base 2.
4. after traversing input array, see if any element in
The problem seems to be minimum dominating set problem (which is NP-complete
i think). But since the number of nodes will be =26, it can be solved by
some intelligent brute force.
Something like this might work:
Take all subsets of the given nodes. Iteratively keep increasing the size of
the
I thk it uses balanced trees (like Red Black Trees).
Not sure though
On Thu, May 29, 2008 at 12:16 PM, Vinodh [EMAIL PROTECTED] wrote:
I am reading about hashing techniques.
The map data structure available in C++ STL uses hashing techniques?