Re: [algogeeks] URGENT suggestion REGARDING placement...............

2011-09-18 Thread Kanika Narang
@shady - can u elaborate upon the companies offering research jobs to
undergrads...

On Sun, Sep 18, 2011 at 10:02 AM, shady sinv...@gmail.com wrote:

 it doesn't matter what your background is if you are able to clear
 technical interviews of google and facebook. about MS and yahoo, they may
 look into your past... but in google, facebook if you are good with
 algorithms no one can stop you.

 If you dont want to code, then try looking for research jobs. :)


 On Sat, Sep 17, 2011 at 8:14 PM, vivek goel vivek.thapar2...@gmail.comwrote:

 hey abhishek.,
 is ur frnd  now able to get job in  pure coding company or
 not?where is he now?
 and  wat's different in Goldman Sachs.
 .
 pl  reply
 but some body told me that  it is possible to go in pure  coding company
 from deloitte
 so pl  elaborate . i am confused


 On Sat, Sep 17, 2011 at 5:28 PM, Abhishek Gupta 
 gupta.abh...@gmail.comwrote:

 If you go for delloitte, its pretty tough to switch back to pure coding
 companies like yahoo etc. One friends of mine is facing same problems after
 working 3 years in delloitte. So be clear and very careful about chosing
 your career. Or try going for Goldman Sachs.

 On Sat, Sep 17, 2011 at 2:43 PM, vivek goel 
 vivek.thapar2...@gmail.comwrote:

 HELLO  FRIENDS,,,
 PLEASE give me advice THAT   agar  *computer branch(B.E.  or MCA) ka
 koi student hai and agar uski deloite consultancy mein hone ke chances ho
 *, as ye *dream 
 company*hai...to aur
 *kisi campus placement mein  baithna us student ko allowed nhi
 hogaafter  getting selected in Deloitte...
 *
 *to use  kya karna *chahiye..agge  aani wali *companies  ki
 taraf dhyan dena chahiye  ya deloitte mein hi  clear karne ki try
 kare...*
 *as abhi aur bhi ** **software companies aani baaki hai college mein.
 . and  wo  bhiachii hai...
 *
 and

 agar wo *deloitte mein* chala bhi jata hai
 to kyaa   baad mein kabhi  later...
 *microsoft,  yahoo, google ya  koi software companies mein ja* payega,
 jo ki *pure coding companies* hai( *agar
 wo baad mein switch krna chahe*).
 as deloitte mein shyd coding ka kaam  kam hoga shyd.

 plss  help.

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 ---
 Regards,
 Abhishek Gupta
 MCA
 NIT Calicut
 Kerela

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Regards
Kanika Narang
IIITD 2008029

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Symantec System programming ques

2011-09-18 Thread sagar pareek
I am supposing that file is count.txt and is already exists

so in initials of the main()
do this

*int count;
FILE* fp;

if((fp=fopen(count.txt,r))==NULL)
{
 printf(File does not exist\n);
 exit(0):
}

fscanf(fp,%d,count);
count++;

fclose(fp);

fp=fopen(count.txt,w);

fprintf(fp,%d,count);

fclose(fp);

*

On Sat, Sep 17, 2011 at 9:36 PM, siva viknesh sivavikne...@gmail.comwrote:

 hi anyone at least provide code using file handling.i found this
 ques from other site

 On Sep 17, 6:35 pm, sivaviknesh s sivavikne...@gmail.com wrote:
  you have to write a program which tell about how many times it has run.
 ex:
 
  if you run first time it will print 1.
  if you run second time it will print 2.
  like this.
 
  this can easily done by File Handling but think other solution like IPC.
 
  after booting your system, your program's output start from 1
 
  answers plz???
 
  --
  Regards,
  $iva

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
**Regards
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT ALLAHABAD

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] c output

2011-09-18 Thread hurtlocker
#includestdio.h

main()

{

int a ;

a=abc();

printf(\n %d this is fisrt a:,a);

a=abc();

printf(\n %d this is second a:,a);

}
int abc()

{

int i=23;

if(10)

return ;

i++;

return(++ i);

}

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] c output

2011-09-18 Thread Bhavesh agrawal
#includestdio.h

main()

{

int a ;

a=abc();

printf(\n %d this is fisrt a:,a);

a=abc();

printf(\n %d this is second a:,a);

}
int abc()

{

int i=23;

if(10)

return ;

i++;

return(++ i);

}

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] DS QUESTION

2011-09-18 Thread kartik sachan
given n nodes ,how many different possible tree can be formed??(not
necessary that all are binary treeit could be any tree...)


-- 

*WITH REGARDS,*
*
*
*KARTIK SACHAN*

*B.TECH 3rd YEAR*
*COMPUTER SCIENCE AND ENGINEERING*
*NIT ALLAHABAD*

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c output

2011-09-18 Thread sukran dhawan
result is not defined by standard c. It doesnt produce compiler error just
because return type is int and no value is returned in if(10)
basically garbage

On Sun, Sep 18, 2011 at 12:23 PM, Bhavesh agrawal agr.bhav...@gmail.comwrote:

 #includestdio.h

 main()

 {

 int a ;

 a=abc();

 printf(\n %d this is fisrt a:,a);

 a=abc();

 printf(\n %d this is second a:,a);

 }
 int abc()

 {

 int i=23;

 if(10)

 return ;

 i++;

 return(++ i);

 }

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c output

2011-09-18 Thread Amol Sharma
it is just printing some garbage value as u have specified return but not
the value.try putting some value with return then you'll understand
what's happening..
--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad
http://gplus.to/amolsharma99
http://twitter.com/amolsharma99http://in.linkedin.com/pub/amol-sharma/21/79b/507http://youtube.com/amolsharma99





On Sun, Sep 18, 2011 at 12:38 PM, sukran dhawan sukrandha...@gmail.comwrote:

 result is not defined by standard c. It doesnt produce compiler error just
 because return type is int and no value is returned in if(10)

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c output

2011-09-18 Thread kartik sachan
@what's special in this ...
it is giving 0 in both cases.
basically a garbage value

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] DS QUESTION

2011-09-18 Thread Amol Sharma
2nCn/(n+1) ..simple maths :)
--


Amol Sharma
Third Year Student
Computer Science and Engineering
MNNIT Allahabad
 http://gplus.to/amolsharma99
http://twitter.com/amolsharma99http://in.linkedin.com/pub/amol-sharma/21/79b/507http://youtube.com/amolsharma99





On Sun, Sep 18, 2011 at 12:37 PM, kartik sachan kartik.sac...@gmail.comwrote:

 given n nodes ,how many different possible tree can be formed??(not
 necessary that all are binary treeit could be any tree...)


 --

 *WITH REGARDS,*
 *
 *
 *KARTIK SACHAN*

 *B.TECH 3rd YEAR*
 *COMPUTER SCIENCE AND ENGINEERING*
 *NIT ALLAHABAD*

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c output

2011-09-18 Thread Bhavesh agrawal
result is this

 -1075990972 this is fisrt a:
 30 this is second a

what is the meaning of a=30 in second call

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c output

2011-09-18 Thread Anup Ghatage
Error.
the 10 condition does not return anything, while the function should return
an int.

On Sun, Sep 18, 2011 at 6:39 AM, hurtlocker bhavesh24...@rediffmail.comwrote:

 #includestdio.h

 main()

 {

 int a ;

 a=abc();

 printf(\n %d this is fisrt a:,a);

 a=abc();

 printf(\n %d this is second a:,a);

 }
 int abc()

 {

 int i=23;

 if(10)

 return ;

 i++;

 return(++ i);

 }

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Anup Ghatage

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c output

2011-09-18 Thread Saravana kumar
0 this is fisrt a:
0 this is second a:

On Sun, Sep 18, 2011 at 12:09 PM, hurtlocker bhavesh24...@rediffmail.comwrote:

 #includestdio.h

 main()

 {

 int a ;

 a=abc();

 printf(\n %d this is fisrt a:,a);

 a=abc();

 printf(\n %d this is second a:,a);

 }
 int abc()

 {

 int i=23;

 if(10)

 return ;

 i++;

 return(++ i);

 }

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Microsoft Question

2011-09-18 Thread Anup Ghatage
For the mentioned scenario, it seems to be the only feasible solution.

On Sun, Sep 18, 2011 at 3:57 AM, bharatkumar bagana 
bagana.bharatku...@gmail.com wrote:

 @anup : the time complexity will be very high ... O(n*M*M)...n=#characters
 to be checked...M=size of the matrix ...


 On Sat, Sep 17, 2011 at 8:30 AM, Anup Ghatage ghat...@gmail.com wrote:

 As WgpShashank once pointed out.

 Search the whole matrix for the first character instances, for each
 instance, send the array, string and that char's position to a function that
 will recursively check its direct neighbors for the next character.
 Exhaustively check like that for each starting characters appearance till
 you find the string, if any.

 On Fri, Sep 16, 2011 at 11:55 PM, Ankur Garg ankurga...@gmail.comwrote:

 In a matrix of. characters, find an string. String can be in any way (all
 8 neighbours to be considered)
 like find Microsoft in below matrix.

  A
 C
 P
 *R
 *C*
 *X
 *S
 **O
 *P
 *C*
 V
 *O*
 V
 N
 *I*
 W
  G
 *F
 **M
 *N
 Q
  A
 *T*
 I
 T

  *Any Ideas How to Solve/Approach this problem ?*


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Anup Ghatage

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --

 **Please do not print this e-mail until urgent requirement. Go Green!!
 Save Papers = Save Trees
 *BharatKumar Bagana*
 **http://www.google.com/profiles/bagana.bharatkumarhttp://www.google.com/profiles/bagana.bharatkumar
 *
 Mobile +91 8056127652*
 bagana.bharatku...@gmail.com


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Anup Ghatage

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] DS QUESTION

2011-09-18 Thread Anup Ghatage
(2n)! / ((n+1)! + (n)!)
Where n is the number of nodes.
The above mentioned formula is for the n'th Catalan number.

@all correct me if I am wrong

On Sun, Sep 18, 2011 at 7:11 AM, Amol Sharma amolsharm...@gmail.com wrote:

 2nCn/(n+1) ..simple maths :)
 --


 Amol Sharma
 Third Year Student
 Computer Science and Engineering
 MNNIT Allahabad
  http://gplus.to/amolsharma99 
 http://twitter.com/amolsharma99http://in.linkedin.com/pub/amol-sharma/21/79b/507http://youtube.com/amolsharma99





 On Sun, Sep 18, 2011 at 12:37 PM, kartik sachan 
 kartik.sac...@gmail.comwrote:

 given n nodes ,how many different possible tree can be formed??(not
 necessary that all are binary treeit could be any tree...)


 --

 *WITH REGARDS,*
 *
 *
 *KARTIK SACHAN*

 *B.TECH 3rd YEAR*
 *COMPUTER SCIENCE AND ENGINEERING*
 *NIT ALLAHABAD*

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Anup Ghatage

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] URGENT suggestion REGARDING placement...............

2011-09-18 Thread saurabh agrawal
Vivek, if there are more god companies going to visit ur college, then u can
wait for them. Everything depends on your interest, but if you want to go
for pure coding companies, then u should skip delloite. Amazon is also
coming for intern, u can wait for that..

Thanks
Saurabh  Agrawal
BE CSE Thapar University

On Sat, Sep 17, 2011 at 2:43 PM, vivek goel vivek.thapar2...@gmail.comwrote:

 HELLO  FRIENDS,,,
 PLEASE give me advice THAT   agar  *computer branch(B.E.  or MCA) ka koi
 student hai and agar uski deloite consultancy mein hone ke chances 
 ho*,
 as ye *dream company* hai...to aur *kisi campus
 placement mein  baithna us student ko allowed nhi  hogaafter  getting
 selected in Deloitte...*
 *to use  kya karna *chahiye..agge  aani wali *companies  ki
 taraf dhyan dena chahiye  ya deloitte mein hi  clear karne ki try
 kare...*
 *as abhi aur bhi ** **software companies aani baaki hai college mein.
 . and  wo  bhiachii hai...
 *
 and

 agar wo *deloitte mein* chala bhi jata hai
 to kyaa   baad mein kabhi  later...
 *microsoft,  yahoo, google ya  koi software companies mein ja* payega,
 jo ki *pure coding companies* hai( *agar wo
 baad mein switch krna chahe*).
 as deloitte mein shyd coding ka kaam  kam hoga shyd.

 plss  help.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c output

2011-09-18 Thread Bhavesh agrawal
another que..

#includestdio.h
main()
{
int a;
int i=10;
printf(%d %d %d\n,i+++i,i,i---i);
printf(%d\n,i---i);
a=i---i;
printf(%d \n%d,a,i);
return 0;
}

output:

18 10 0
0
0
8

how ??

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c output

2011-09-18 Thread sukran dhawan
again undefined in standard c :)

On Sun, Sep 18, 2011 at 1:49 PM, Bhavesh agrawal agr.bhav...@gmail.comwrote:

 another que..


 #includestdio.h
 main()
 {
 int a;
 int i=10;
 printf(%d %d %d\n,i+++i,i,i---i);
 printf(%d\n,i---i);
 a=i---i;
 printf(%d \n%d,a,i);
 return 0;
 }

 output:

 18 10 0
 0
 0
 8

 how ??

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] binary tree

2011-09-18 Thread prasanth n
You are given a binary tree in which each node contains a value. Design an
ALGORITHM to print all paths which sum up to that value. Note that it can be
any path in the tree - it does not have to start at the root.

-- 
*prasanth*

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] binary tree

2011-09-18 Thread abhishek sharma
hi prasanth,

i was asked a similar ques but with the condition that path shud terminate
at a leaf node  u just have to return true if you are able to find a path.

what i did was,
- do an inorder traversal (u have to pass a parameter that represents
sum as well along with treenode pointer)
- at every leaf check the value of cumulative sum of all the parents'
data and the current node's data

for printing paths u can use a stack



On Sun, Sep 18, 2011 at 2:26 PM, prasanth n nprasnt...@gmail.com wrote:

 You are given a binary tree in which each node contains a value. Design an
 ALGORITHM to print all paths which sum up to that value. Note that it can be
 any path in the tree - it does not have to start at the root.

 --
 *prasanth*

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Nice Day

Abhishek Sharma
Bachelor of Technology
IIT Kanpur (2009)

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] binary tree

2011-09-18 Thread abhishek sharma
for your question -


On Sun, Sep 18, 2011 at 3:44 PM, abhishek sharma abhishek.p...@gmail.comwrote:

 hi prasanth,

 i was asked a similar ques but with the condition that path shud terminate
 at a leaf node  u just have to return true if you are able to find a path.

 what i did was,
 - do an inorder traversal (u have to pass a parameter that represents
 sum as well along with treenode pointer)
 - at every leaf check the value of cumulative sum of all the parents'
 data and the current node's data

 for printing paths u can use a stack




 On Sun, Sep 18, 2011 at 2:26 PM, prasanth n nprasnt...@gmail.com wrote:

 You are given a binary tree in which each node contains a value. Design an
 ALGORITHM to print all paths which sum up to that value. Note that it can be
 any path in the tree - it does not have to start at the root.

 --
 *prasanth*

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Nice Day

 Abhishek Sharma
 Bachelor of Technology
 IIT Kanpur (2009)




-- 
Nice Day

Abhishek Sharma
Bachelor of Technology
IIT Kanpur (2009)

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] K-LCS

2011-09-18 Thread pooja
Can some one please help me with this..
the problem is to find  the longest substring in a list of around 100
strings..??
any idea..

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] K-LCS

2011-09-18 Thread Yogesh Yadav
struct string_node
{
 char str[];
 int length;
 struct string_node *ptr;
}

now traverse the strings and saving strings in str[],their length in
length and point it to next string_node




On Sun, Sep 18, 2011 at 4:47 PM, pooja pooja27tan...@gmail.com wrote:

 Can some one please help me with this..
 the problem is to find  the longest substring in a list of around 100
 strings..??
 any idea..

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: K-LCS

2011-09-18 Thread pooja

sorry.. i meant the longest common substring..
eg. consider 4 string.. ababa , bab , babba, abab
so the longest common substring is bab.

On Sep 18, 4:40 pm, Yogesh Yadav medu...@gmail.com wrote:
 struct string_node
 {
  char str[];
  int length;
  struct string_node *ptr;

 }

 now traverse the strings and saving strings in str[],their length in
 length and point it to next string_node

 







 On Sun, Sep 18, 2011 at 4:47 PM, pooja pooja27tan...@gmail.com wrote:
  Can some one please help me with this..
  the problem is to find  the longest substring in a list of around 100
  strings..??
  any idea..

  --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: K-LCS

2011-09-18 Thread Yogesh Yadav
store strings in array of pointers...char *str[100]

str[0]str[99]

make every possible suffix and prefix for each string...
for ex. str[0]=ababa
possible suffix={ababa,abab,aba,ab,a}
possible prefix={ababa,baba,aba,ba,a}

so make a structure for storing these suffix and prefixes and their count in
other strings
struct node
{
char str[];
int count;
struct node *next;
}
now save these suffix and prefixes in these nodes and initialize  their
count  with 0
after making sets for all strings...count their occurences in other nodes
with help of loops...

and then check for largest count...

...

On Sun, Sep 18, 2011 at 5:24 PM, pooja pooja27tan...@gmail.com wrote:


 sorry.. i meant the longest common substring..
 eg. consider 4 string.. ababa , bab , babba, abab
 so the longest common substring is bab.

 On Sep 18, 4:40 pm, Yogesh Yadav medu...@gmail.com wrote:
  struct string_node
  {
   char str[];
   int length;
   struct string_node *ptr;
 
  }
 
  now traverse the strings and saving strings in str[],their length in
  length and point it to next string_node
 
  
 
 
 
 
 
 
 
  On Sun, Sep 18, 2011 at 4:47 PM, pooja pooja27tan...@gmail.com wrote:
   Can some one please help me with this..
   the problem is to find  the longest substring in a list of around 100
   strings..??
   any idea..
 
   --
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] c output,printf(%llx)

2011-09-18 Thread wujin chen
usigned long long x = 0x12345678;
int a = 0x09;
int b = 0x10;
printf(a=%x, b=%llx,a,b,c);

the result is: a=9,b=123456780010

i wonder why~~

can anyone explain it?
thanks.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] plssssssssss replyyyyyyyyyyyyyyyyy

2011-09-18 Thread vivek goel
which  profile is  better??

1.  Technology Consulting
2. Quality Control Analyst Systems

if one is from software engg ( programming) background.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] plssssssssss replyyyyyyyyyyyyyyyyy

2011-09-18 Thread malay chakrabarti
depends on your forte. :)
best of luck for either one :)

On Sun, Sep 18, 2011 at 10:15 PM, vivek goel vivek.thapar2...@gmail.comwrote:

 which  profile is  better??

 1.  Technology Consulting
 2. Quality Control Analyst Systems

 if one is from software engg ( programming) background.

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-18 Thread Ashima .
rite! 62.5%
Ashima
M.Sc.(Tech)Information Systems
4th year
BITS Pilani
Rajasthan




On Sat, Sep 17, 2011 at 9:04 PM, malay chakrabarti m1234...@gmail.comwrote:

 create a tournament tree.in each round one value is eliminated to obtain
 in the process the winner or the highest value in n-1 comparisons. Then
 check the queue of the winner which contains log(n) entries of the values
 beaten by the winner which implicitly will contain the runners up.Then
 log(n)-1 comparisons to find the highest among all the losers whom the
 winner had beaten. So all over complexity will be n-1 +log(n) -1 =
 n+log(n)-2. Hp that answers ur query. nice question btw :)


 On Sun, Sep 18, 2011 at 8:02 AM, VIHARRI viharri@gmail.com wrote:

 hey i'm also thinking n + logn -2.. but couldnt able to figure out
 how??? can you please explain the logic

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] DS QUESTION

2011-09-18 Thread Jagannath Prasad Das
@Amol:the answer u have given is for binary ..and thats catalan
number...recursive solution

On Sun, Sep 18, 2011 at 1:33 PM, Anup Ghatage ghat...@gmail.com wrote:

 (2n)! / ((n+1)! + (n)!)
 Where n is the number of nodes.
 The above mentioned formula is for the n'th Catalan number.

 @all correct me if I am wrong


 On Sun, Sep 18, 2011 at 7:11 AM, Amol Sharma amolsharm...@gmail.comwrote:

 2nCn/(n+1) ..simple maths :)
 --


 Amol Sharma
 Third Year Student
 Computer Science and Engineering
 MNNIT Allahabad
  http://gplus.to/amolsharma99 
 http://twitter.com/amolsharma99http://in.linkedin.com/pub/amol-sharma/21/79b/507http://youtube.com/amolsharma99





 On Sun, Sep 18, 2011 at 12:37 PM, kartik sachan 
 kartik.sac...@gmail.comwrote:

 given n nodes ,how many different possible tree can be formed??(not
 necessary that all are binary treeit could be any tree...)


 --

 *WITH REGARDS,*
 *
 *
 *KARTIK SACHAN*

 *B.TECH 3rd YEAR*
 *COMPUTER SCIENCE AND ENGINEERING*
 *NIT ALLAHABAD*

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Anup Ghatage

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-18 Thread Ashima .
@malay: how cm n+logn-2?
cn u explain the logic ?
Ashima
M.Sc.(Tech)Information Systems
4th year
BITS Pilani
Rajasthan




On Sun, Sep 18, 2011 at 11:07 AM, Ashima . ashima.b...@gmail.com wrote:

 rite! 62.5%

 Ashima
 M.Sc.(Tech)Information Systems
 4th year
 BITS Pilani
 Rajasthan




 On Sat, Sep 17, 2011 at 9:04 PM, malay chakrabarti m1234...@gmail.comwrote:

 create a tournament tree.in each round one value is eliminated to obtain
 in the process the winner or the highest value in n-1 comparisons. Then
 check the queue of the winner which contains log(n) entries of the values
 beaten by the winner which implicitly will contain the runners up.Then
 log(n)-1 comparisons to find the highest among all the losers whom the
 winner had beaten. So all over complexity will be n-1 +log(n) -1 =
 n+log(n)-2. Hp that answers ur query. nice question btw :)


 On Sun, Sep 18, 2011 at 8:02 AM, VIHARRI viharri@gmail.com wrote:

 hey i'm also thinking n + logn -2.. but couldnt able to figure out
 how??? can you please explain the logic

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: DS QUESTION

2011-09-18 Thread wasim
2n!/n!(n+1)!
catalan number

also asked by directi in written ...


wasim akram
MCA 3rd year

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Microsoft Question

2011-09-18 Thread vikas
hmm, nice questions, can we create an  efficient DS to query the
strings ??


tried using trie but memory prints are very large ( O(n^2) )? :-((



On Sep 18, 12:59 pm, Anup Ghatage ghat...@gmail.com wrote:
 For the mentioned scenario, it seems to be the only feasible solution.

 On Sun, Sep 18, 2011 at 3:57 AM, bharatkumar bagana 









 bagana.bharatku...@gmail.com wrote:
  @anup : the time complexity will be very high ... O(n*M*M)...n=#characters
  to be checked...M=size of the matrix ...

  On Sat, Sep 17, 2011 at 8:30 AM, Anup Ghatage ghat...@gmail.com wrote:

  As WgpShashank once pointed out.

  Search the whole matrix for the first character instances, for each
  instance, send the array, string and that char's position to a function 
  that
  will recursively check its direct neighbors for the next character.
  Exhaustively check like that for each starting characters appearance till
  you find the string, if any.

  On Fri, Sep 16, 2011 at 11:55 PM, Ankur Garg ankurga...@gmail.comwrote:

  In a matrix of. characters, find an string. String can be in any way (all
  8 neighbours to be considered)
  like find Microsoft in below matrix.

   A
  C
  P
  *R
  *C*
  *X
  *S
  **O
  *P
  *C*
  V
  *O*
  V
  N
  *I*
  W
   G
  *F
  **M
  *N
  Q
   A
  *T*
  I
  T

   *Any Ideas How to Solve/Approach this problem ?*

   --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.

  --
  Anup Ghatage

   --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.

  --

  **Please do not print this e-mail until urgent requirement. Go Green!!
  Save Papers = Save Trees
  *BharatKumar Bagana*
  **http://www.google.com/profiles/bagana.bharatkumarhttp://www.google.com/profiles/bagana.bharatkumar
  *
  Mobile +91 8056127652*
  bagana.bharatku...@gmail.com

   --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.

 --
 Anup Ghatage

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-18 Thread Nitin Garg
Answer  3 - 100
Answer 6 - 103
Answer 4 - 194 total processes including the parent
Answer 7 - 12 km south, 12 km east

On Sun, Sep 18, 2011 at 11:53 PM, Ashima . ashima.b...@gmail.com wrote:

 @malay: how cm n+logn-2?
 cn u explain the logic ?

 Ashima
 M.Sc.(Tech)Information Systems
 4th year
 BITS Pilani
 Rajasthan




 On Sun, Sep 18, 2011 at 11:07 AM, Ashima . ashima.b...@gmail.com wrote:

 rite! 62.5%

 Ashima
 M.Sc.(Tech)Information Systems
 4th year
 BITS Pilani
 Rajasthan




 On Sat, Sep 17, 2011 at 9:04 PM, malay chakrabarti m1234...@gmail.comwrote:

 create a tournament tree.in each round one value is eliminated to obtain
 in the process the winner or the highest value in n-1 comparisons. Then
 check the queue of the winner which contains log(n) entries of the values
 beaten by the winner which implicitly will contain the runners up.Then
 log(n)-1 comparisons to find the highest among all the losers whom the
 winner had beaten. So all over complexity will be n-1 +log(n) -1 =
 n+log(n)-2. Hp that answers ur query. nice question btw :)


 On Sun, Sep 18, 2011 at 8:02 AM, VIHARRI viharri@gmail.com wrote:

 hey i'm also thinking n + logn -2.. but couldnt able to figure out
 how??? can you please explain the logic

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Nitin Garg

Personality can open doors... but only Character can keep them open

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Microsoft Question

2011-09-18 Thread Piyush Grover
for(i = 0; i  n; i++)
   for(j = 0; j  n; j++){
  setColor(i, j) = black;
   if(A[i][j] == str[0]){
  setColor(i, j) = blue;
  a =  findWord(A, i, j, str, 1)
  if(!a) setColor(i, j) = black;
   else break;
}
   }

findWord(A, i, j, str, k){
if(k == strlen(str))
  return true;

 if(A[i-1][j-1] == str[k]  getColor(i-1, j-1) != blue)
  setColor(i-1, j-1) = blue;
  a = findWord(A, i-1, j-1, str, k+1);

 if(A[i-1][j] == str[k]  getColor(i-1, j) != blue)
 setColor(i-1, j) = blue;
  a = findWord(A, i-1, j, str, k+1);

 if(A[i-1][j+1] == str[k]  getColor(i-1, j+1) != blue)
  setColor(i-1, j+1) = blue;
  a = findWord(A, i-1, j+1, str, k+1);

 if(A[i][j-1] == str[k]  getColor(i, j-1) != blue)
 setColor(i, j-1) = blue;
  a = findWord(A, i, j-1, str, k+1);

 if(A[i][j+1] == str[k]  getColor(i, j+1) != blue)
  setColor(i, j+1) = blue;
  a = findWord(A, i, j+1, str, k+1);

  if(A[i+1][j-1] == str[k]  getColor(i+1, j-1) != blue)
  setColor(i+1, j-1) = blue;
  a = findWord(A, i+1, j-1, str, k+1);

  if(A[i+1][j] == str[k]  getColor(i+1, j) != blue)
  setColor(i+1, j) = blue;
  a = findWord(A, i+1, j, str, k+1);

  if(A[i+1][j+1] == str[k]  getColor(i+1, j+1) != blue)
   setColor(i+1, j+1) = blue;
   a = findWord(A, i+1, j+1, str, k+1);

  if(!a)  setColor(i, j) = black;

  return a;
}

This is a pseudo code. I haven't considered the boundary cases to make it
understandable.



On Mon, Sep 19, 2011 at 12:21 AM, vikas vikas.rastogi2...@gmail.com wrote:

 hmm, nice questions, can we create an  efficient DS to query the
 strings ??


 tried using trie but memory prints are very large ( O(n^2) )? :-((



 On Sep 18, 12:59 pm, Anup Ghatage ghat...@gmail.com wrote:
  For the mentioned scenario, it seems to be the only feasible solution.
 
  On Sun, Sep 18, 2011 at 3:57 AM, bharatkumar bagana 
 
 
 
 
 
 
 
 
 
  bagana.bharatku...@gmail.com wrote:
   @anup : the time complexity will be very high ...
 O(n*M*M)...n=#characters
   to be checked...M=size of the matrix ...
 
   On Sat, Sep 17, 2011 at 8:30 AM, Anup Ghatage ghat...@gmail.com
 wrote:
 
   As WgpShashank once pointed out.
 
   Search the whole matrix for the first character instances, for each
   instance, send the array, string and that char's position to a
 function that
   will recursively check its direct neighbors for the next character.
   Exhaustively check like that for each starting characters appearance
 till
   you find the string, if any.
 
   On Fri, Sep 16, 2011 at 11:55 PM, Ankur Garg ankurga...@gmail.com
 wrote:
 
   In a matrix of. characters, find an string. String can be in any way
 (all
   8 neighbours to be considered)
   like find Microsoft in below matrix.
 
A
   C
   P
   *R
   *C*
   *X
   *S
   **O
   *P
   *C*
   V
   *O*
   V
   N
   *I*
   W
G
   *F
   **M
   *N
   Q
A
   *T*
   I
   T
 
*Any Ideas How to Solve/Approach this problem ?*
 
--
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
   --
   Anup Ghatage
 
--
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
   --
 
   **Please do not print this e-mail until urgent requirement. Go Green!!
   Save Papers = Save Trees
   *BharatKumar Bagana*
   **http://www.google.com/profiles/bagana.bharatkumar
 http://www.google.com/profiles/bagana.bharatkumar
   *
   Mobile +91 8056127652*
   bagana.bharatku...@gmail.com
 
--
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
  --
  Anup Ghatage

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to 

[algogeeks]

2011-09-18 Thread UTKARSH SRIVASTAV
how to find second largest element than current element in an array given
condition that we have to find that second largest element from index 1 to
the index of the current element only in most efficient way

-- 
*UTKARSH SRIVASTAV
CSE-3
B-Tech 3rd Year
@MNNIT ALLAHABAD*

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks]

2011-09-18 Thread UTKARSH SRIVASTAV
how to find second largest element than current element in an array given
condition that we have to find that second largest element from index 1 to
the index of the current element

-- 
*UTKARSH SRIVASTAV
CSE-3
B-Tech 3rd Year
@MNNIT ALLAHABAD*

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-18 Thread teja bala
@Nithin Garg how 194 for the 4 question?

On Mon, Sep 19, 2011 at 12:26 AM, Nitin Garg nitin.garg.i...@gmail.comwrote:

 Answer  3 - 100
 Answer 6 - 103
 Answer 4 - 194 total processes including the parent
 Answer 7 - 12 km south, 12 km east


 On Sun, Sep 18, 2011 at 11:53 PM, Ashima . ashima.b...@gmail.com wrote:

 @malay: how cm n+logn-2?
 cn u explain the logic ?

 Ashima
 M.Sc.(Tech)Information Systems
 4th year
 BITS Pilani
 Rajasthan




 On Sun, Sep 18, 2011 at 11:07 AM, Ashima . ashima.b...@gmail.com wrote:

 rite! 62.5%

 Ashima
 M.Sc.(Tech)Information Systems
 4th year
 BITS Pilani
 Rajasthan




 On Sat, Sep 17, 2011 at 9:04 PM, malay chakrabarti 
 m1234...@gmail.comwrote:

 create a tournament tree.in each round one value is eliminated to
 obtain in the process the winner or the highest value in n-1 comparisons.
 Then check the queue of the winner which contains log(n) entries of the
 values beaten by the winner which implicitly will contain the runners
 up.Then log(n)-1 comparisons to find the highest among all the losers whom
 the winner had beaten. So all over complexity will be n-1 +log(n) -1 =
 n+log(n)-2. Hp that answers ur query. nice question btw :)


 On Sun, Sep 18, 2011 at 8:02 AM, VIHARRI viharri@gmail.com wrote:

 hey i'm also thinking n + logn -2.. but couldnt able to figure out
 how??? can you please explain the logic

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Nitin Garg

 Personality can open doors... but only Character can keep them open

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c output,printf(%llx)

2011-09-18 Thread sagar pareek
Check out what u have written...


On Sun, Sep 18, 2011 at 7:17 PM, wujin chen wujinchen...@gmail.com wrote:

 usigned long long x = 0x12345678;
 int a = 0x09;
 int b = 0x10;
 printf(a=%x, b=%llx,a,b,c);

 the result is: a=9,b=123456780010

 i wonder why~~

 can anyone explain it?
 thanks.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
**Regards
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT ALLAHABAD

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks]

2011-09-18 Thread sagar pareek
Give some examples ,i m not getting ur question

On Mon, Sep 19, 2011 at 1:45 AM, UTKARSH SRIVASTAV
usrivastav...@gmail.comwrote:

 how to find second largest element than current element in an array given
 condition that we have to find that second largest element from index 1 to
 the index of the current element

 --
 *UTKARSH SRIVASTAV
 CSE-3
 B-Tech 3rd Year
 @MNNIT ALLAHABAD*


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
**Regards
SAGAR PAREEK
COMPUTER SCIENCE AND ENGINEERING
NIT ALLAHABAD

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] complement

2011-09-18 Thread Arun Vishwanathan
Hi all,

When I take negation of an integer in C, 0 is displayed as -1
~5 is displayed as -6.
Can some one tell me the logic of how this conversion is happening in C?

Arun

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] c output,printf(%llx)

2011-09-18 Thread wujin chen
sorry , it should be :

usigned long long c = 0x12345678;
int a = 0x09;
int b = 0x10;
printf(a=%x, b=%llx,a,b,c);


2011/9/19 sagar pareek sagarpar...@gmail.com

 Check out what u have written...


 On Sun, Sep 18, 2011 at 7:17 PM, wujin chen wujinchen...@gmail.comwrote:

 usigned long long x = 0x12345678;
 int a = 0x09;
 int b = 0x10;
 printf(a=%x, b=%llx,a,b,c);

 the result is: a=9,b=123456780010

 i wonder why~~

 can anyone explain it?
 thanks.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 **Regards
 SAGAR PAREEK
 COMPUTER SCIENCE AND ENGINEERING
 NIT ALLAHABAD

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: complement

2011-09-18 Thread Dave
@Arun: This is the way two's complement arithmetic works. For any x, -
x = ~x + 1. This says that to negate a number, complement it and add
1.

Technically speaking, two's complement is a weighted code. Each bit
position has a certain weight that is added in if the bit in that
position is a 1. Counting from the right (low-order bit), the weights
are 1, 2, 4, 8, ..., -2^(n-1), where n is the number of bits in the
integer. Thus, for example, for 8 bit integers, the weights are 1, 2,
4, 8, 16, 32, 64, and -128.

Let bi be the ith bit of the number, counting from the right with
the low order bit being bit 0. Let wi be the weight of the ith bit.
Then the value of the number is

V = sum from i = 0 to n-1 of (bi * wi).

The value of the complement of the number is

~V = sum from i = 0 to n-1 of ((1 - bi) * wi),

where 1 - bi is the complement of bit i, i.e., ~bi. Then

V + ~V = sum from i = 0 to n-1 of wi since bi cancels -bi for
every i.

The sum of the weights is -1. Thus, V + ~V = -1, from which -V = ~V +
1.

Dave

On Sep 18, 5:26 pm, Arun Vishwanathan aaron.nar...@gmail.com wrote:
 Hi all,

 When I take negation of an integer in C, 0 is displayed as -1
 ~5 is displayed as -6.
 Can some one tell me the logic of how this conversion is happening in C?

 Arun

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: c output,printf(%llx)

2011-09-18 Thread Dave
@Wujin: What do you expect the output to be? How does it differ from
what you actually get?

Dave

On Sep 18, 8:47 am, wujin chen wujinchen...@gmail.com wrote:
 usigned long long x = 0x12345678;
 int a = 0x09;
 int b = 0x10;
 printf(a=%x, b=%llx,a,b,c);

 the result is: a=9,b=123456780010

 i wonder why~~

 can anyone explain it?
 thanks.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: complement

2011-09-18 Thread Arun Vishwanathan
Thanks Dave , appreciate it

On Sun, Sep 18, 2011 at 7:15 PM, Dave dave_and_da...@juno.com wrote:

 @Arun: This is the way two's complement arithmetic works. For any x, -
 x = ~x + 1. This says that to negate a number, complement it and add
 1.

 Technically speaking, two's complement is a weighted code. Each bit
 position has a certain weight that is added in if the bit in that
 position is a 1. Counting from the right (low-order bit), the weights
 are 1, 2, 4, 8, ..., -2^(n-1), where n is the number of bits in the
 integer. Thus, for example, for 8 bit integers, the weights are 1, 2,
 4, 8, 16, 32, 64, and -128.

 Let bi be the ith bit of the number, counting from the right with
 the low order bit being bit 0. Let wi be the weight of the ith bit.
 Then the value of the number is

 V = sum from i = 0 to n-1 of (bi * wi).

 The value of the complement of the number is

 ~V = sum from i = 0 to n-1 of ((1 - bi) * wi),

 where 1 - bi is the complement of bit i, i.e., ~bi. Then

 V + ~V = sum from i = 0 to n-1 of wi since bi cancels -bi for
 every i.

 The sum of the weights is -1. Thus, V + ~V = -1, from which -V = ~V +
 1.

 Dave

 On Sep 18, 5:26 pm, Arun Vishwanathan aaron.nar...@gmail.com wrote:
  Hi all,
 
  When I take negation of an integer in C, 0 is displayed as -1
  ~5 is displayed as -6.
  Can some one tell me the logic of how this conversion is happening in C?
 
  Arun

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
 People often say that motivation doesn't last. Well, neither does bathing
- that's why we recommend it daily.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] complement

2011-09-18 Thread sukran dhawan
2's complement

On Mon, Sep 19, 2011 at 3:56 AM, Arun Vishwanathan
aaron.nar...@gmail.comwrote:

 Hi all,

 When I take negation of an integer in C, 0 is displayed as -1
 ~5 is displayed as -6.
 Can some one tell me the logic of how this conversion is happening in C?

 Arun

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] plssssssssss replyyyyyyyyyyyyyyyyy

2011-09-18 Thread siddharth srivastava
agreeing with Malay.
Better depends upon where you want to see yourself after 5 years or so.

PS: Please try to give some meaningful subject line before

On 18 September 2011 22:25, malay chakrabarti m1234...@gmail.com wrote:

 depends on your forte. :)
 best of luck for either one :)


 On Sun, Sep 18, 2011 at 10:15 PM, vivek goel 
 vivek.thapar2...@gmail.comwrote:

 which  profile is  better??

 1.  Technology Consulting
 2. Quality Control Analyst Systems

 if one is from software engg ( programming) background.

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Regards
Siddharth Srivastava

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] plssssssssss replyyyyyyyyyyyyyyyyy

2011-09-18 Thread Anand Saha
Going by choice of your subject line, none.

-- 


On Sun, Sep 18, 2011 at 10:15 PM, vivek goel vivek.thapar2...@gmail.comwrote:

 which  profile is  better??

 1.  Technology Consulting
 2. Quality Control Analyst Systems

 if one is from software engg ( programming) background.

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Microsoft Question

2011-09-18 Thread Piyush Grover
sry, in the findWord function all a's are different e.g
a0, a1a7

and if(!a) is actually if(a0||a1||...||a7)

thnx
piyush

On Mon, Sep 19, 2011 at 1:10 AM, Piyush Grover piyush4u.iit...@gmail.comwrote:

 for(i = 0; i  n; i++)
for(j = 0; j  n; j++){
   setColor(i, j) = black;
if(A[i][j] == str[0]){
   setColor(i, j) = blue;
   a =  findWord(A, i, j, str, 1)
   if(!a) setColor(i, j) = black;
else break;
 }
}

 findWord(A, i, j, str, k){
 if(k == strlen(str))
   return true;

  if(A[i-1][j-1] == str[k]  getColor(i-1, j-1) != blue)
   setColor(i-1, j-1) = blue;
   a = findWord(A, i-1, j-1, str, k+1);

  if(A[i-1][j] == str[k]  getColor(i-1, j) != blue)
  setColor(i-1, j) = blue;
   a = findWord(A, i-1, j, str, k+1);

  if(A[i-1][j+1] == str[k]  getColor(i-1, j+1) != blue)
   setColor(i-1, j+1) = blue;
   a = findWord(A, i-1, j+1, str, k+1);

  if(A[i][j-1] == str[k]  getColor(i, j-1) != blue)
  setColor(i, j-1) = blue;
   a = findWord(A, i, j-1, str, k+1);

  if(A[i][j+1] == str[k]  getColor(i, j+1) != blue)
   setColor(i, j+1) = blue;
   a = findWord(A, i, j+1, str, k+1);

   if(A[i+1][j-1] == str[k]  getColor(i+1, j-1) != blue)
   setColor(i+1, j-1) = blue;
   a = findWord(A, i+1, j-1, str, k+1);

   if(A[i+1][j] == str[k]  getColor(i+1, j) != blue)
   setColor(i+1, j) = blue;
   a = findWord(A, i+1, j, str, k+1);

   if(A[i+1][j+1] == str[k]  getColor(i+1, j+1) != blue)
setColor(i+1, j+1) = blue;
a = findWord(A, i+1, j+1, str, k+1);

if(!a)  setColor(i, j) = black;

   return a;
 }

 This is a pseudo code. I haven't considered the boundary cases to make it
 understandable.



 On Mon, Sep 19, 2011 at 12:21 AM, vikas vikas.rastogi2...@gmail.comwrote:

 hmm, nice questions, can we create an  efficient DS to query the
 strings ??


 tried using trie but memory prints are very large ( O(n^2) )? :-((



 On Sep 18, 12:59 pm, Anup Ghatage ghat...@gmail.com wrote:
  For the mentioned scenario, it seems to be the only feasible solution.
 
  On Sun, Sep 18, 2011 at 3:57 AM, bharatkumar bagana 
 
 
 
 
 
 
 
 
 
  bagana.bharatku...@gmail.com wrote:
   @anup : the time complexity will be very high ...
 O(n*M*M)...n=#characters
   to be checked...M=size of the matrix ...
 
   On Sat, Sep 17, 2011 at 8:30 AM, Anup Ghatage ghat...@gmail.com
 wrote:
 
   As WgpShashank once pointed out.
 
   Search the whole matrix for the first character instances, for each
   instance, send the array, string and that char's position to a
 function that
   will recursively check its direct neighbors for the next character.
   Exhaustively check like that for each starting characters appearance
 till
   you find the string, if any.
 
   On Fri, Sep 16, 2011 at 11:55 PM, Ankur Garg ankurga...@gmail.com
 wrote:
 
   In a matrix of. characters, find an string. String can be in any way
 (all
   8 neighbours to be considered)
   like find Microsoft in below matrix.
 
A
   C
   P
   *R
   *C*
   *X
   *S
   **O
   *P
   *C*
   V
   *O*
   V
   N
   *I*
   W
G
   *F
   **M
   *N
   Q
A
   *T*
   I
   T
 
*Any Ideas How to Solve/Approach this problem ?*
 
--
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
   --
   Anup Ghatage
 
--
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
   --
 
   **Please do not print this e-mail until urgent requirement. Go Green!!
   Save Papers = Save Trees
   *BharatKumar Bagana*
   **http://www.google.com/profiles/bagana.bharatkumar
 http://www.google.com/profiles/bagana.bharatkumar
   *
   Mobile +91 8056127652*
   bagana.bharatku...@gmail.com
 
--
   You received this message because you are subscribed to the Google
 Groups
   Algorithm Geeks group.
   To post to this group, send email to algogeeks@googlegroups.com.
   To unsubscribe from this group, send email to
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
  --
  Anup Ghatage

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email 

Re: [algogeeks]

2011-09-18 Thread Yogesh Yadav
current position is index n (say)
largest=0;
second_largest=0;

for(i=1;i=n;i++)
{
if(a[i]a[n])
{
if(a[i]largest)
{
second_largest=largest;
largest=a[i];
}
elseif(a[i]second_largest)
second_largest=a[i];
}
}




On Mon, Sep 19, 2011 at 2:15 AM, sagar pareek sagarpar...@gmail.com wrote:

 Give some examples ,i m not getting ur question


 On Mon, Sep 19, 2011 at 1:45 AM, UTKARSH SRIVASTAV 
 usrivastav...@gmail.com wrote:

 how to find second largest element than current element in an array given
 condition that we have to find that second largest element from index 1 to
 the index of the current element

 --
 *UTKARSH SRIVASTAV
 CSE-3
 B-Tech 3rd Year
 @MNNIT ALLAHABAD*


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 **Regards
 SAGAR PAREEK
 COMPUTER SCIENCE AND ENGINEERING
 NIT ALLAHABAD

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: K-LCS

2011-09-18 Thread Arun
Suffix Tree

On Sep 18, 4:17 pm, pooja pooja27tan...@gmail.com wrote:
 Can some one please help me with this..
 the problem is to find  the longest substring in a list of around 100
 strings..??
 any idea..

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.