Re: [algogeeks] finding element in array with minimum of comparing

2012-09-30 Thread atul anand
yes, but there no need of checking outside the loop n=sizeof(arr)-1; do { if(elem==arr[n]) print found; n--; }while(n); On Mon, Oct 1, 2012 at 9:33 AM, Navin Kumar wrote: > @atul: keep one more checking outside loop for element at 0 th index. > Because when n = 0 the your lo

Re: [algogeeks] finding element in array with minimum of comparing

2012-09-30 Thread Navin Kumar
@atul: keep one more checking outside loop for element at 0 th index. Because when n = 0 the your loop come out from the loop without comparing it. On Mon, Oct 1, 2012 at 8:55 AM, atul anand wrote: > n=sizeof(arr); > n--; > > while(n) > { > if(elem=arr[n]) > print found; > > n--;

Re: [algogeeks] finding element in array with minimum of comparing

2012-09-30 Thread atul anand
n=sizeof(arr); n--; while(n) { if(elem=arr[n]) print found; n--; } On Sun, Sep 30, 2012 at 2:56 PM, רפי וינר wrote: > Hi > i was in an interview and was given a simple function > int arrExsits(int* arr,int size,int elem){ > for (int i=0;i if(elem==arr[i]) >return i;

Re: [algogeeks] Facebook question!

2012-09-30 Thread atul anand
your debugged code :- error you were making was in tacking the row at each recursive call...and outer loop runs for 2...which should actually runs for all words #include #include #include using namespace std; string str[]={"hello", "how","a"}; #define words_len 3 void print_all(string sel, int row

Re: [algogeeks] Facebook question!

2012-09-30 Thread atul anand
my prev code was incorrect :- here is the correct code :- void combination(char str[3][100],int len,int row,int j) { static char prn[3]; int i=0,k=0,p=0; if(j==2) { prn[j]='\0'; printf("\n%s",prn); return; } for(p=ro

Re: [algogeeks] Facebook question!

2012-09-30 Thread atul anand
void combination(char str[2][100],int len,int row,int j) { static char prn[3]; int i=0,k=0,p=0; if(j==2) { prn[j]='\0'; printf("\n%s",prn); } for(p=row;p wrote: > Given 'n' arrays each of variable sizes. Write code to print all >

[algogeeks] Learning bioinformatics with rosalind

2012-09-30 Thread Wladimir Tavares
http://rosalind.info/problems/as-table/ http://translate.google.com.br/translate?hl=pt-BR&sl=pt&tl=en&u=http%3A%2F%2Fmarathoncode.blogspot.com.br%2F2012%2F09%2Faprendendo-bionformatica-com-rosalind.html Wladimir Araujo Tavares *Federal University of Ceará Homepage

[algogeeks] finding element in array with minimum of comparing

2012-09-30 Thread רפי וינר
Hi i was in an interview and was given a simple function int arrExsits(int* arr,int size,int elem){ for (int i=0;ihttp://groups.google.com/group/algogeeks?hl=en.