googlybhai
BAN USERFor 1 and 2 non repeating numbers cases XOR method is OK.
For 3 or more nonrepeating numbers we have to use hashtable and for repetition we need to count the appearance. In final round we need to go through whole hash table and output the numbers which appeared exactly once.

googlybhai
October 02, 2013 Garbage collector needs to iterate (may be DFS or BFS) and then build a graph for objects which are pointing to each other (may be using shared_ptr) using shared_ptr (original objects ) and weak_ptr (for objects which are pointing to original object). So if original objects goes away it can be deleted, because other objects which are pointing to it will be weak_ptr (which don;t increment reference count).

googlybhai
October 02, 2013 We need to use a hash table which will take input as node of input graph and give output as node of new graph, if there is an input node that is not yet mapped then we need to allocate new node and insert that mapping into hash table.
 googlybhai March 06, 2013For 1  50 , give each ladder +1 weight and snake +1 and now apply Dijkstra Single Source Shortest path algorithm.
For 51100, give each ladder a weight of (end point  starting point) and each snake a weight of 1, now apply Bellman Ford or Floyd Warshall algo, longest path can be infinite.
Here we have to follow a top down approach (greedy one) with back tracking.
 googlybhai October 16, 2012GKalchev is just hinting at Majority Vote algorithm
Please follow cs.utexas.edu/~moore/bestideas/mjrty/index.html

googlybhai
October 10, 2012 //Making multithreadedsafe
int checker(int k,int i){
int j;
for(j=1;j<=k1;j++)
{
if((m[j]==i)(m[j]i==jk)  (m[j]i==kj))
{
return(0);
}
}
return(1);
}
void solve(int n, int nq, int *m){
if(n==nq+1) {
cout<<endl<<endl<<endl<<"soln"<<s++;
for(int i=1;i<n;i++)
{
cout<<endl;
for(int j=1;j<n;j++)
{
if( (m[i]==j))
cout<<"Q";
else
cout<<"";
}
}
}
else
{
for(int i=1;i<=nq;i++)
{
if(checker(n,i)==1)
{
m[n]=i;
solve(n+1);
}
}
}
}
int main()
{
int nq;
int *m;
cout<<"Enter number of queens:\n";
cin>>nq;
if (nq<=0)
{
cout<<"enter valid value of number of queens";
return 1;
}
m = new int[nq+1];
solve(1,nq, m);
}

googlybhai
September 27, 2012 //modified for generalized case
int *m;
int checker(int k,int i){
int j;
for(j=1;j<=k1;j++)
{
if((m[j]==i)(m[j]i==jk)  (m[j]i==kj))
{
return(0);
}
}
return(1);
}
void solve(int n, int nq){
if(n==nq+1) {
cout<<endl<<endl<<endl<<"soln"<<s++;
for(int i=1;i<n;i++)
{
cout<<endl;
for(int j=1;j<n;j++)
{
if( (m[i]==j))
cout<<"Q";
else
cout<<"";
}
}
}
else
{
for(int i=1;i<=nq;i++)
{
if(checker(n,i)==1)
{
m[n]=i;
solve(n+1);
}
}
}
}
int main()
{
int nq;
cout<<"Enter number of queens:\n";
cin>>nq;
if (nq<=0)
{
cout<<"enter valid value of number of queens";
return 1;
}
m = new int[nq+1];
solve(0,nq);
}

googlybhai
September 27, 2012 //reformatting for making more readable
//I have modfied since result is not required, also some local variable should be moved outside
public static void circularWay (int[][] matrix) {
int[][] hash = new int[matrix.length][matrix[0].length];
int[][] moves = new int[][] {{0,1},{1,0},{0,1},{1,0}};
int i = 0; int j = 0;
int m = 0;
int row;
int column;
while (hash[i][j] == 0) {
row = i + moves[m][0];
column = j + moves[m][1];
if ((row < matrix.length) && (column < matrix[0].length)
&& (row >= 0) && (column >= 0)
&& (hash[row][column] == 0)) {
System.out.print( matrix[i][j]+" ");
hash[i][j] = 1;
i = row;
j = column;
} else {
m++;
if (m > 3) m = 0;
row = i + moves[m][0];
column = j + moves[m][1];
if ((hash[row][column] != 0)) {
System.out.print(matrix[i][j]+" ");
hash[i][j] = 1;
}
}
}
}

googlybhai
September 27, 2012 // check the below code taken from stackoverflow
int findMajorityElement(int * arr, int size) {
int count = 0, i, majorityElement;
for (i = 0 ; < size ; i++) {
if(count == 0) {
majorityElement = arr[i];
}
if(arr[i] == majorityElement)
count++;
else
count;
}
count = 0;
for (i=0; i < size ; i++) {
if (arr[i] == majorityElement) {
count++;
}
}
if ( count > size/2) {
return majorityElement;
}
else return 1;
}

googlybhai
September 09, 2012 It is a classic problem of multiple readers and single writer.
But you can refer to code for given in operating systems: concurrent and distributed software design by Jean Bacon and Tim Harris

googlybhai
March 06, 2012 Please find it below address:
careercup.com/question?id=12217186

googlybhai
February 24, 2012 An exe is an executible program. A DLL (Dynamic Link Library) is a file that can be loaded and executed by programs dynamically. Basically it's an external code repository for programs. Since usually several different programs reuse the same DLL instead of having that code in their own file, this dramatically reduces required storage space. A synonym for a DLL would be library.
DLL does not have main function but exe has main function
Here DLL is inprocess component, both component an
Taken from :
wiki.answers.com/Q/What_is_the_difference_between_an_EXE_and_a_DLL#ixzz1nKN5TMmV

googlybhai
February 24, 2012 It is given by Motzkin number
check the en.wikipedia.org/wiki/Motzkin_number
use DP

googlybhai
February 20, 2012 In my view ashu soln is best because it is using constant space O(1) complexity and time complexity is O(n).

googlybhai
February 19, 2012 please check below for explanation
mathsisfun.com/pool_balls_solution.html

googlybhai
February 18, 2012 please check below for explanation
mathsisfun.com/pool_balls_solution.html
please check below for explaination
mathsisfun.com/pool_balls_solution.html
It is made from steel because it does not get rust also.

googlybhai
February 17, 2012 Check the solution at geeksforgeeks
 googlybhai February 06, 2012Please check this link
question with ID 12362800
Open Chat in New Window
 googlybhai October 07, 2013