[algogeeks] Re: MS question

2011-10-03 Thread pranav agrawal
@rahul sharma, i ran this code, it is producing wrong answer :|

check it,  http://codepad.org/THv1hJq1

anyone with correct solution?

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/26XU3UBqZ6EJ.
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: MS question

2011-10-03 Thread shady
search archives :-/

On Mon, Oct 3, 2011 at 11:47 AM, pranav agrawal 
pranav.is.cool.agra...@gmail.com wrote:

 @rahul sharma, i ran this code, it is producing wrong answer :|

 check it,  http://codepad.org/THv1hJq1

 anyone with correct solution?

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/26XU3UBqZ6EJ.

 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: MS question

2011-10-03 Thread rahul sharma
yeah it is wrong..i have a solution but uses 0(n+m) space.i need it
in 0(n*m) tymand o(1) space

On Mon, Oct 3, 2011 at 11:55 AM, shady sinv...@gmail.com wrote:

 search archives :-/


 On Mon, Oct 3, 2011 at 11:47 AM, pranav agrawal 
 pranav.is.cool.agra...@gmail.com wrote:

 @rahul sharma, i ran this code, it is producing wrong answer :|

 check it,  http://codepad.org/THv1hJq1

 anyone with correct solution?

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/26XU3UBqZ6EJ.

 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] Re: string compress/expand

2011-10-03 Thread Rahul Verma
@rahul sharma
 
for that you have to check that string is alphanumeric or not. if it is 
alphanumeric then you have to call the function exapansion else you have to 
call the compression function.
 
and
 
if the desired output for *abc *is *a1b1c1* then you have to call the 
*exapnsion 
function* or if the desired output is *abc* then you have to add a feature 
in the *compression function* i.e. in output the string have to omit the 1's 

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/8olzJ_YJVWMJ.
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: string compress/expand

2011-10-03 Thread rahul sharma
check my code for compression..

check if it is ok
abc i/p
o/p abc

means if character has no count.but still present in string it is its only
occurance.plz check that code...

#includeiostream.h
#includeconio.h
int main()
{
cout\nenter the string;
char str[30];
cinstr;
int c=1;
for(int i=0;str[i];i++)
{
if(str[i+1]='0'  str[i+1]='9')
{
c=c+(str[i+1]-'0');
for(int j=1;jc;j++)
coutstr[i];
  i++;

}

   else
   coutstr[i];
   c=1;


}

getch();

   }



On Mon, Oct 3, 2011 at 12:08 PM, Rahul Verma rahulverma@gmail.comwrote:

 @rahul sharma

 for that you have to check that string is alphanumeric or not. if it is
 alphanumeric then you have to call the function exapansion else you have to
 call the compression function.

 and

 if the desired output for *abc *is *a1b1c1* then you have to call the 
 *exapnsion
 function* or if the desired output is *abc* then you have to add a feature
 in the *compression function* i.e. in output the string have to omit the
 1's

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/8olzJ_YJVWMJ.

 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] zigzag matrix

2011-10-03 Thread Dheeraj Sharma
i gues..this will serve ur purpose

n = rows,m=columns ,arr[n][m] is matrix

for(int i=0;in;i++)
{
int j=0,k=i;
while(k=0  jm)
{
   coutarr[k][j] ;
   k--;
   j++;
   }
coutendl;
}
for(int i=1;im;i++)
{
int j=i,k=n-1;
while(k=0  jm)
{
   coutarr[k][j] ;
   k--;
   j++;
   }
coutendl;
}

On Mon, Oct 3, 2011 at 12:11 AM, Anika Jain anika.jai...@gmail.com wrote:

 for a N * M matrix is is possible to print zigzag fashion of that matrix?
 For example:

 1  2  3  4  5
 6   7  8  9  10
 11 12 13 14 15

 i want print like

 1
 6 2
 11 7 3
 12 8 4
 13 9 5
 14 10
 15

 I am able to get this where N !=M..
 How can i do this, ??

 --
 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.




-- 
*Dheeraj Sharma*

-- 
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: zigzag matrix

2011-10-03 Thread Rahul Verma
@Anika
 
What do you mean with the zigzag fashion here in problem?

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/5rO1BmBFlZwJ.
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] why java program has main function named public static void main(..) ?

2011-10-03 Thread Vengadanathan
Hello everyone , i recently attended a mock interview kept by one of 
my alumni , i was asked the following questions , 

Question asked : What language JVM is written ?

I answerd : In c ...

correct then 


Question asked : why java main function is declared as public static void 
main() ?

I answerd :
main() can be accessed by other classes so it is declared public , and
by declaring static the jvm can call the main function directly by 
classname.main(..) without creating a object ..

But they asked me in turn , 
Why would main function called and used by other classes ? 
JVM is written is c , why does then it call classname.main() (oops is not 
supported in c) while executing a java program instead it can directly 
traverse through the byte code and execute the main function
 
I answerd  : 

can any one please give explanation / answer for the questions they asked 
... thanx in advance .



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/a9PWhQjSnvcJ.
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] InterNSHIP for PRE final YEAR....................Hydrabaad MS

2011-10-03 Thread rahul sharma
http://www.microsoft-careers.com/job/Hyderabad-Intern-Job/1439341/?feedId=315utm_source=Indeed

-- 
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] why java program has main function named public static void main(..) ?

2011-10-03 Thread siddharam suresh
public for visible to compiler/interpreter.
static only one main for one class/file/package.
void return none to compile/interpreter.
Thank you,
Sid.



On Mon, Oct 3, 2011 at 1:35 PM, Vengadanathan fantastic.n...@gmail.com wrote:
 Hello everyone , i recently attended a mock interview kept by one of
 my alumni , i was asked the following questions ,
 Question asked : What language JVM is written ?
 I answerd : In c ...

 correct then

 Question asked : why java main function is declared as public static void
 main() ?
 I answerd :
 main() can be accessed by other classes so it is declared public , and
 by declaring static the jvm can call the main function directly by
 classname.main(..) without creating a object ..
 But they asked me in turn ,
 Why would main function called and used by other classes ?
 JVM is written is c , why does then it call classname.main() (oops is not
 supported in c) while executing a java program instead it can directly
 traverse through the byte code and execute the main function

 I answerd  : 
 can any one please give explanation / answer for the questions they asked
 ... thanx in advance .


 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/a9PWhQjSnvcJ.
 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 help

2011-10-03 Thread rahul sharma
% p prints the corresponding argument that is pointer.can nyone given an
xample plz?

-- 
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] sony errcsn

2011-10-03 Thread saurabh tripathi
which collz is it coming???

On Sat, Oct 1, 2011 at 10:01 AM, bihari kumarvive...@gmail.com wrote:

 plzzz tell me procedure about sony ercssn.
 this compy will come in maah campus ..
 s pl give me info about thispl

 --
 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] Sapient Help!!

2011-10-03 Thread rajul jain
Hi akanksha
Thanks for your information .Today i have cleared my written, can you please
share some information about both interview process specifically that
attribute round  what sort of question they asked in that interview.

Rajul

On Fri, Sep 30, 2011 at 5:35 PM, Akanksha . akanksha...@gmail.com wrote:

 I m a 2011 passout n sapient had visited my clg in jan 2011.. first of
 all, u ll go thru a written test consising of apti ( quant, logical
 reasoning n english ) and one paper of c,ds n c++ combined... den u r
 shortlisted for technical interview in which dey ask u some puzzles n
 ques related to dbms, ds, os etc(depends on ur inteviewer),once u
 clear ur technical round, u ll hav a hr interview which is also an
 elimination round.. so prepare well n all d best :)

 On Fri, Sep 30, 2011 at 4:59 PM, Prags onlypr...@gmail.com wrote:
  @Akaknsha- hv sapient visited ur college ?? if yes , then what is its
  procedure ?
 
  On Wed, Sep 28, 2011 at 9:32 PM, Akanksha . akanksha...@gmail.com
 wrote:
 
  wrk culture is gud mostly.. if u want to do gud technical wrk den
  avoid dis company otherwise if u r interested in management or nething
  like dat den u can go for it..
 
  On Wed, Sep 28, 2011 at 8:15 PM, rohit rajuljain...@gmail.com wrote:
   Is anybody know about sapient working culture?
  
   --
   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.
 

 --
 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] Opera Solutions

2011-10-03 Thread DIVIJ WADHAWAN
Is anyone familiar with Opera Solutions ?? What kind of written test do they
take , what do they expect out of you skills wise ?

-- 
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] Plz Explain the working

2011-10-03 Thread Shuaib
Chk is a macro that gets replaced with an if statement. The else part gets 
attached to the most recent if which is the one from the macro. And since the 
condition in macro fails, the else clause is executed. 

--
Shuaib
http://twitter.com/ShuaibKhan
http://www.bytehood.com/

On 03-Oct-2011, at 4:47 PM, ~*~VICKY~*~ venkat.jun...@gmail.com wrote:

 #includestdio.h
 #define chk(cond) if(!(cond))\
 fprintf(stderr,chk failed: %s,file %s, line %d \n, #cond,\
 __FILE__,__LINE__),abort()
 main()
 {
 int i = 0;
 if(i==0)
 chk(i  100);
 else
 printf(hello);
 printf( world);
 }
 
 output: hello world
 
 can anyone clearly explain how this works.
 
 
 -- 
 Cheers,
  
   Vicky
 
 -- 
 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: zigzag matrix

2011-10-03 Thread DIVIJ WADHAWAN
What do u mean by Zig-Zag ??

On Mon, Oct 3, 2011 at 12:48 PM, Rahul Verma rahulverma@gmail.comwrote:

 @Anika

 What do you mean with the zigzag fashion here in problem?

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/5rO1BmBFlZwJ.

 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] New Group For Practicing and Learning Efficient Ways of Coding

2011-10-03 Thread shady
We can discuss codes here, and how to solve problems in detail with better
runtime. No spamming please. Every week we will solve atleast 5 problems[
keeping weekends off :p ]
Problems will be taken from online judges so that we can practice there and
then discuss better ways of solving that particular problem.

http://groups.google.com/group/http://groups.google.com/group/acm_practice?hl=en
*acm_practice http://groups.google.com/group/acm_practice?hl=en*

Shady

-- 
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] Plz Explain the working

2011-10-03 Thread ~*~VICKY~*~
@Shauib: cool soln. Thank you.

On Mon, Oct 3, 2011 at 6:14 PM, Shuaib aries.shu...@gmail.com wrote:

 Chk is a macro that gets replaced with an if statement. The else part gets
 attached to the most recent if which is the one from the macro. And since
 the condition in macro fails, the else clause is executed.

 --
 Shuaib
 http://twitter.com/ShuaibKhan
 http://www.bytehood.com/

 On 03-Oct-2011, at 4:47 PM, ~*~VICKY~*~ venkat.jun...@gmail.com wrote:

 #includestdio.h
 #define chk(cond) if(!(cond))\
 fprintf(stderr,chk failed: %s,file %s, line %d \n, #cond,\
 __FILE__,__LINE__),abort()
 main()
 {
 int i = 0;
 if(i==0)
 chk(i  100);
 else
 printf(hello);
 printf( world);
 }

 output: hello world

 can anyone clearly explain how this works.


 --
 Cheers,

   Vicky

  --
 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.




-- 
Cheers,

  Vicky

-- 
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] New Group For Practicing and Learning Efficient Ways of Coding

2011-10-03 Thread DIVIJ WADHAWAN
I have joined but there are no posts and only 11 members.

On Mon, Oct 3, 2011 at 6:36 PM, shady sinv...@gmail.com wrote:

 We can discuss codes here, and how to solve problems in detail with better
 runtime. No spamming please. Every week we will solve atleast 5 problems[
 keeping weekends off :p ]
 Problems will be taken from online judges so that we can practice there and
 then discuss better ways of solving that particular problem.

 http://groups.google.com/group/http://groups.google.com/group/acm_practice?hl=en
 *acm_practice http://groups.google.com/group/acm_practice?hl=en*

 Shady

 --
 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] Sourcebits [wrriten n interview round]

2011-10-03 Thread Vendetta .
hey, in our collg they hav told no written round for sourcebits they wud
give us some assignment... any idea abt it

-- 
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] test the following code with the data given

2011-10-03 Thread g4ur4v
Original question= http://www.codechef.com/problems/WORDS1

code=

#includestdio.h
#includestring.h
#includestdlib.h
//#includeconio.h


int compare(const void *a,const void *b)
{
const char *a_=*(const char **)a;
const char *b_=*(const char **)b;
return(strcmp((char *)a_,(char *)b_));
}
int main()
{
int t,n,i,j,k,sts=0;
char **A;
char Bi[1000];



scanf(%d,t);// input number of test cases
while(t--)
{
  scanf(%d,n);//input number of strings for each
test case
  A=new char*[n];
  for(i=0;in;++i)
  {

   scanf(%s,Bi);//input the strings
   int l=strlen(Bi);
   A[i]=new char[l];
   strcpy(A[i],Bi);
  }
//  delete Bi;


  qsort(A,n,sizeof(char*),compare);   //sorting the
strings


   bool B[n];

  for(i=0;in;++i)
  B[i]=true;


  int f=1;
  char s,e;


  for(j=0;jn;++j)
  {
  s=A[j][0];
  B[j]=false;
  e=A[j][strlen(A[j])-1];

  for(i=0;in;++i)
  {
 if(B[i])
 {
 if(A[i][0]==e)
 {
 B[i]=false;
 e=A[i][strlen(A[i])-1];
 ++f;
 i=0;
 }
 }
  }
  if(f==n)
  {
  printf(Ordering is possible.\n);
  sts=1;
  goto outside;

  }


  for(k=0;kn;++k)
  B[k]=true;
  f=1;
  }
//  delete []B;

  outside:

  if(sts==0)
  printf(The door cannot be opened.\n);

  }


   }





TEST CASES
1)  1
 2
 ok
 ok
output=The door cannot be opened.
(so the code works fine for this case.)

2) 2
2
directi
codechef
3
skenzo
logicboxes
orderbox
output=The door cannot be opened.
 Ordering is possible.
(so the code works fine for this case too.)

3)3
   2
   directi
   codechef
   3
   skenzo
   logicboxes
   orderbox
   2
   ok
   ok

the code doesnt give output and stops responding as soon as 3 case
starts processing..


Plz...explain why is this happening and how to rectify this code...
Plz..reply asap.

-- 
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] New Group For Practicing and Learning Efficient Ways of Coding

2011-10-03 Thread gaurav yadav
I think once the questions are posted more peolpe will join in...

-- 
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] Plz Explain the working

2011-10-03 Thread Prakash D
+1

On Mon, Oct 3, 2011 at 6:40 PM, ~*~VICKY~*~ venkat.jun...@gmail.com wrote:

 @Shauib: cool soln. Thank you.


 On Mon, Oct 3, 2011 at 6:14 PM, Shuaib aries.shu...@gmail.com wrote:

 Chk is a macro that gets replaced with an if statement. The else part gets
 attached to the most recent if which is the one from the macro. And since
 the condition in macro fails, the else clause is executed.

 --
 Shuaib
 http://twitter.com/ShuaibKhan
 http://www.bytehood.com/

 On 03-Oct-2011, at 4:47 PM, ~*~VICKY~*~ venkat.jun...@gmail.com
 wrote:

 #includestdio.h
 #define chk(cond) if(!(cond))\
 fprintf(stderr,chk failed: %s,file %s, line %d \n, #cond,\
 __FILE__,__LINE__),abort()
 main()
 {
 int i = 0;
 if(i==0)
 chk(i  100);
 else
 printf(hello);
 printf( world);
 }

 output: hello world

 can anyone clearly explain how this works.


 --
 Cheers,

   Vicky

  --
 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.




 --
 Cheers,

   Vicky

  --
 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] Sapient Help!!

2011-10-03 Thread Akanksha .
In the technical interview round dey asked me questions on bst
searching, hashing, triggers n other ques in dbms, writing a query, 2
puzzles n some ques on OS which i dnt remember.. n in the HR interview
round, dey asked me specifically abt my projects n others things dat
were der in my resume..

On Mon, Oct 3, 2011 at 6:09 PM, rajul jain rajuljain...@gmail.com wrote:
 Hi akanksha
 Thanks for your information .Today i have cleared my written, can you please
 share some information about both interview process specifically that
 attribute round  what sort of question they asked in that interview.
 Rajul

 On Fri, Sep 30, 2011 at 5:35 PM, Akanksha . akanksha...@gmail.com wrote:

 I m a 2011 passout n sapient had visited my clg in jan 2011.. first of
 all, u ll go thru a written test consising of apti ( quant, logical
 reasoning n english ) and one paper of c,ds n c++ combined... den u r
 shortlisted for technical interview in which dey ask u some puzzles n
 ques related to dbms, ds, os etc(depends on ur inteviewer),once u
 clear ur technical round, u ll hav a hr interview which is also an
 elimination round.. so prepare well n all d best :)

 On Fri, Sep 30, 2011 at 4:59 PM, Prags onlypr...@gmail.com wrote:
  @Akaknsha- hv sapient visited ur college ?? if yes , then what is its
  procedure ?
 
  On Wed, Sep 28, 2011 at 9:32 PM, Akanksha . akanksha...@gmail.com
  wrote:
 
  wrk culture is gud mostly.. if u want to do gud technical wrk den
  avoid dis company otherwise if u r interested in management or nething
  like dat den u can go for it..
 
  On Wed, Sep 28, 2011 at 8:15 PM, rohit rajuljain...@gmail.com wrote:
   Is anybody know about sapient working culture?
  
   --
   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.
 

 --
 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] test the following code with the data given

2011-10-03 Thread shady
it is easy to rewrite the whole code correctly than finding a bug in this
code. don't ask someone else to debug your codes, else you will get 

On Mon, Oct 3, 2011 at 7:03 PM, g4ur4v gauravyadav1...@gmail.com wrote:

 Original question= http://www.codechef.com/problems/WORDS1

 code=

 #includestdio.h
 #includestring.h
 #includestdlib.h
 //#includeconio.h


 int compare(const void *a,const void *b)
 {
const char *a_=*(const char **)a;
const char *b_=*(const char **)b;
return(strcmp((char *)a_,(char *)b_));
 }
 int main()
 {
int t,n,i,j,k,sts=0;
char **A;
char Bi[1000];



scanf(%d,t);// input number of test cases
while(t--)
{
  scanf(%d,n);//input number of strings for each
 test case
  A=new char*[n];
  for(i=0;in;++i)
  {

   scanf(%s,Bi);//input the strings
   int l=strlen(Bi);
   A[i]=new char[l];
   strcpy(A[i],Bi);
  }
//  delete Bi;


  qsort(A,n,sizeof(char*),compare);   //sorting the
 strings


   bool B[n];

  for(i=0;in;++i)
  B[i]=true;


  int f=1;
  char s,e;


  for(j=0;jn;++j)
  {
  s=A[j][0];
  B[j]=false;
  e=A[j][strlen(A[j])-1];

  for(i=0;in;++i)
  {
 if(B[i])
 {
 if(A[i][0]==e)
 {
 B[i]=false;
 e=A[i][strlen(A[i])-1];
 ++f;
 i=0;
 }
 }
  }
  if(f==n)
  {
  printf(Ordering is possible.\n);
  sts=1;
  goto outside;

  }


  for(k=0;kn;++k)
  B[k]=true;
  f=1;
  }
//  delete []B;

  outside:

  if(sts==0)
  printf(The door cannot be opened.\n);

  }


   }





 TEST CASES
 1)  1
 2
 ok
 ok
 output=The door cannot be opened.
 (so the code works fine for this case.)

 2) 2
2
directi
codechef
3
skenzo
logicboxes
orderbox
 output=The door cannot be opened.
 Ordering is possible.
 (so the code works fine for this case too.)

 3)3
   2
   directi
   codechef
   3
   skenzo
   logicboxes
   orderbox
   2
   ok
   ok

 the code doesnt give output and stops responding as soon as 3 case
 starts processing..


 Plz...explain why is this happening and how to rectify this code...
 Plz..reply asap.

 --
 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: zigzag matrix

2011-10-03 Thread shady
exactly problem is defined in such a vague manner what is zig-zag ?

always post links of the place from where you copy the question.

On Mon, Oct 3, 2011 at 6:18 PM, DIVIJ WADHAWAN divij...@gmail.com wrote:

 What do u mean by Zig-Zag ??


 On Mon, Oct 3, 2011 at 12:48 PM, Rahul Verma rahulverma@gmail.comwrote:

 @Anika

 What do you mean with the zigzag fashion here in problem?

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/5rO1BmBFlZwJ.

 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] suggestion

2011-10-03 Thread sukran dhawan
Hello guys,
Here is a suggestion.With so much talented people in this group,why cant we
a website that is similar to geeksforgeeks.
It will be really helpful to others if all the topics are well organised in
the form of website
This is just a suggestion.just ignore the message if im wrong or u guys don
like the 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] suggestion

2011-10-03 Thread Ankur Garg
Nice Idea but for pulling this you need committed people :)

On Mon, Oct 3, 2011 at 7:36 PM, sukran dhawan sukrandha...@gmail.comwrote:

 Hello guys,
 Here is a suggestion.With so much talented people in this group,why cant we
 a website that is similar to geeksforgeeks.
 It will be really helpful to others if all the topics are well organised in
 the form of website
 This is just a suggestion.just ignore the message if im wrong or u guys don
 like the 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] suggestion

2011-10-03 Thread Ankur Garg
Committed to launch a website,formatting ..clarifying in case you mistook it
for somethin else :D

On Mon, Oct 3, 2011 at 7:50 PM, Ankur Garg ankurga...@gmail.com wrote:

 Nice Idea but for pulling this you need committed people :)

 On Mon, Oct 3, 2011 at 7:36 PM, sukran dhawan sukrandha...@gmail.comwrote:

 Hello guys,
 Here is a suggestion.With so much talented people in this group,why cant
 we a website that is similar to geeksforgeeks.
 It will be really helpful to others if all the topics are well organised
 in the form of website
 This is just a suggestion.just ignore the message if im wrong or u guys
 don like the 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] suggestion

2011-10-03 Thread shady
people can't even post questions properly
same question being asked again and again, so many coders from Russia,
Poland, have stopped participating here :-(
all discussions are which company ? what is ctc ? what is asked ? what
should i do ? if one gets job and then that person becomes immune :-/
seriously lol


On Mon, Oct 3, 2011 at 7:50 PM, Ankur Garg ankurga...@gmail.com wrote:

 Nice Idea but for pulling this you need committed people :)

 On Mon, Oct 3, 2011 at 7:36 PM, sukran dhawan sukrandha...@gmail.comwrote:

 Hello guys,
 Here is a suggestion.With so much talented people in this group,why cant
 we a website that is similar to geeksforgeeks.
 It will be really helpful to others if all the topics are well organised
 in the form of website
 This is just a suggestion.just ignore the message if im wrong or u guys
 don like the 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] Can Any1 provide a proper implementation of a Hashtable(Seperation Chaining) in C,C++

2011-10-03 Thread Ankur Garg


-- 
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] oracle finance questions

2011-10-03 Thread amit kannaujiya
if any one know  regarding oracle finance online test, plz post type of
questions asked in online test .

-- 
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] suggestion

2011-10-03 Thread sunny agrawal
There is a Website that was initiated after the success of its community
Algorithms on ORKUT
but if i will post the link here people will start spamming there also :P
like shady sad :(

People have taken this group from Algorithms Group to
X_Interview_Questions_Database_Group.
seriously Bad :(



On Mon, Oct 3, 2011 at 7:54 PM, shady sinv...@gmail.com wrote:

 people can't even post questions properly
 same question being asked again and again, so many coders from Russia,
 Poland, have stopped participating here :-(
 all discussions are which company ? what is ctc ? what is asked ? what
 should i do ? if one gets job and then that person becomes immune :-/
 seriously lol


 On Mon, Oct 3, 2011 at 7:50 PM, Ankur Garg ankurga...@gmail.com wrote:

 Nice Idea but for pulling this you need committed people :)

 On Mon, Oct 3, 2011 at 7:36 PM, sukran dhawan sukrandha...@gmail.comwrote:

 Hello guys,
 Here is a suggestion.With so much talented people in this group,why cant
 we a website that is similar to geeksforgeeks.
 It will be really helpful to others if all the topics are well organised
 in the form of website
 This is just a suggestion.just ignore the message if im wrong or u guys
 don like the 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.




-- 
Sunny Aggrawal
B.Tech. V year,CSI
Indian Institute Of Technology,Roorkee

-- 
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] suggestion

2011-10-03 Thread sunny agrawal
And About Posting Questions on The Group
It is a humble request to the members of the group (who are reading this
post) that Please Don't Post Question in the subject of the message.
rather put related topic name in the subject, which can give a idea what the
question is about.

On Mon, Oct 3, 2011 at 8:09 PM, sunny agrawal sunny816.i...@gmail.comwrote:

 There is a Website that was initiated after the success of its community
 Algorithms on ORKUT
 but if i will post the link here people will start spamming there also :P
 like shady sad :(

 People have taken this group from Algorithms Group to
 X_Interview_Questions_Database_Group.
 seriously Bad :(




 On Mon, Oct 3, 2011 at 7:54 PM, shady sinv...@gmail.com wrote:

 people can't even post questions properly
 same question being asked again and again, so many coders from Russia,
 Poland, have stopped participating here :-(
 all discussions are which company ? what is ctc ? what is asked ? what
 should i do ? if one gets job and then that person becomes immune :-/
 seriously lol


 On Mon, Oct 3, 2011 at 7:50 PM, Ankur Garg ankurga...@gmail.com wrote:

 Nice Idea but for pulling this you need committed people :)

 On Mon, Oct 3, 2011 at 7:36 PM, sukran dhawan sukrandha...@gmail.comwrote:

 Hello guys,
 Here is a suggestion.With so much talented people in this group,why cant
 we a website that is similar to geeksforgeeks.
 It will be really helpful to others if all the topics are well organised
 in the form of website
 This is just a suggestion.just ignore the message if im wrong or u guys
 don like the 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.




 --
 Sunny Aggrawal
 B.Tech. V year,CSI
 Indian Institute Of Technology,Roorkee




-- 
Sunny Aggrawal
B.Tech. V year,CSI
Indian Institute Of Technology,Roorkee

-- 
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: zigzag matrix

2011-10-03 Thread Hatta
Zig Zag gets the diagonals from the matrix as if you were calculating
the determinant.
I know many OPs are not very clear in their statements but with a bit
of goodwill I could grab this one. :-)



On Mon, Oct 3, 2011 at 11:01 AM, shady sinv...@gmail.com wrote:
 exactly problem is defined in such a vague manner what is zig-zag ?
 always post links of the place from where you copy the question.

 On Mon, Oct 3, 2011 at 6:18 PM, DIVIJ WADHAWAN divij...@gmail.com wrote:

 What do u mean by Zig-Zag ??

 On Mon, Oct 3, 2011 at 12:48 PM, Rahul Verma rahulverma@gmail.com
 wrote:

 @Anika

 What do you mean with the zigzag fashion here in problem?

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/5rO1BmBFlZwJ.
 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.




-- 
Hatta

-- 
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] suggestion

2011-10-03 Thread saurabh singh
+1

On Mon, Oct 3, 2011 at 8:13 PM, sunny agrawal sunny816.i...@gmail.comwrote:

 And About Posting Questions on The Group
 It is a humble request to the members of the group (who are reading this
 post) that Please Don't Post Question in the subject of the message.
 rather put related topic name in the subject, which can give a idea what
 the question is about.


 On Mon, Oct 3, 2011 at 8:09 PM, sunny agrawal sunny816.i...@gmail.comwrote:

 There is a Website that was initiated after the success of its community
 Algorithms on ORKUT
 but if i will post the link here people will start spamming there also :P
 like shady sad :(

 People have taken this group from Algorithms Group to
 X_Interview_Questions_Database_Group.
 seriously Bad :(




 On Mon, Oct 3, 2011 at 7:54 PM, shady sinv...@gmail.com wrote:

 people can't even post questions properly
 same question being asked again and again, so many coders from Russia,
 Poland, have stopped participating here :-(
 all discussions are which company ? what is ctc ? what is asked ? what
 should i do ? if one gets job and then that person becomes immune :-/
 seriously lol


 On Mon, Oct 3, 2011 at 7:50 PM, Ankur Garg ankurga...@gmail.com wrote:

 Nice Idea but for pulling this you need committed people :)

 On Mon, Oct 3, 2011 at 7:36 PM, sukran dhawan 
 sukrandha...@gmail.comwrote:

 Hello guys,
 Here is a suggestion.With so much talented people in this group,why
 cant we a website that is similar to geeksforgeeks.
 It will be really helpful to others if all the topics are well
 organised in the form of website
 This is just a suggestion.just ignore the message if im wrong or u guys
 don like the 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.




 --
 Sunny Aggrawal
 B.Tech. V year,CSI
 Indian Institute Of Technology,Roorkee




 --
 Sunny Aggrawal
 B.Tech. V year,CSI
 Indian Institute Of Technology,Roorkee

  --
 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.




-- 
Thanks  Regards,
Saurabh

-- 
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: zigzag matrix

2011-10-03 Thread Ravi Shankar
Lets' say,

0i=3(n)
0j=5(m)

for(k=2 to n+m)
{
 find_set_of(i,j) s.t. i+j =k
print all the matrix elements for (i,j);
}

Regards,
Ravi Shankar,
R D,
Cloud Life Cycle Management
HCL Comnet,
Noida,
Ph:995369



On Mon, Oct 3, 2011 at 8:32 PM, Hatta tmd...@gmail.com wrote:

 Zig Zag gets the diagonals from the matrix as if you were calculating
 the determinant.
 I know many OPs are not very clear in their statements but with a bit
 of goodwill I could grab this one. :-)



 On Mon, Oct 3, 2011 at 11:01 AM, shady sinv...@gmail.com wrote:
  exactly problem is defined in such a vague manner what is zig-zag ?
  always post links of the place from where you copy the question.
 
  On Mon, Oct 3, 2011 at 6:18 PM, DIVIJ WADHAWAN divij...@gmail.com
 wrote:
 
  What do u mean by Zig-Zag ??
 
  On Mon, Oct 3, 2011 at 12:48 PM, Rahul Verma rahulverma@gmail.com
  wrote:
 
  @Anika
 
  What do you mean with the zigzag fashion here in problem?
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To view this discussion on the web visit
  https://groups.google.com/d/msg/algogeeks/-/5rO1BmBFlZwJ.
  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.
 



 --
 Hatta

 --
 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] IF ANYONE have c# 2008 or 2010 black book plz mail reply ASAP....

2011-10-03 Thread Deoki Nandan
Thanx in advance

-- 
**With Regards
Deoki Nandan Vishwakarma

*
*

-- 
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] fibonicci doubt

2011-10-03 Thread Hatta
why you guys write in colors?
my eyes are bleeding



On Sun, Oct 2, 2011 at 11:36 PM, rahul sharma rahul23111...@gmail.com wrote:
 guys if i have
 Print the sum of the even terms occuring in Fibbonaci (till 1000 terms)
 then i will go for(i=0;i=1000;i++)
 {
 fibonicii code
 add if even
 }
 for 1000 fib terms
 if i have Print the sum of the even terms occuring in Fibbonaci (till 1000)
 it indicates that we will stop when we reached 1000 ..
 m i getting it ryt guys

 --
 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.




-- 
Hatta

-- 
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 help

2011-10-03 Thread Hatta
#include stdio.h
int main(void) {
   int x = 10;
   int *p = malloc(16);

   printf(%p %p\n, x, p);
   return 0;
}

first will print an address in the stack
second an address in heap

no big deal, uh? :)

On Mon, Oct 3, 2011 at 7:28 AM, rahul sharma rahul23111...@gmail.com wrote:
 % p prints the corresponding argument that is pointer.can nyone given an
 xample plz?

 --
 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.




-- 
Hatta

-- 
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: Urgent sol needed

2011-10-03 Thread Shruti Gupta
Hi!
A effecient way to solve the problem in O(1) space is by making use of
the fact that instead of keeping track of which cell has a 0, we can
just know which row or column has zero, as eventually that row/col
will become 0. The code looks like this:

public static void setZeros(int[][] matrix) {
  int[] row = new int[matrix.length];
  int[] column = new int[matrix[0].length];
  // Store the row and column index with value 0
for (int i = 0; i  matrix.length; i++) {
   for (int j = 0; j  matrix[0].length;j++) {
   if (matrix[i][j] == 0) {
 row[i] = 1;
 column[j] = 1;
 }
 }
}

 // Set arr[i][j] to 0 if either row i or column j has a 0
  for (int i = 0; i  matrix.length; i++) {
   for (int j = 0; j  matrix[0].length; j++) {
   if ((row[i] == 1 || column[j] == 1)) {
  matrix[i][j] = 0;
   }
 }
 }

Thus there is no extra space taken.

Shruti

On Oct 3, 12:27 am, rahul sharma rahul23111...@gmail.com wrote:
 nput is a matrix of size n x m of 0s and 1s.

 eg:
 1 0 0 1
 0 0 1 0
 0 0 0 0

 If a location has 1; make all the elements of that row and column = 1. eg

 1 1 1 1
 1 1 1 1
 1 0 1 1

 Solution should be with Time complexity = O(n*m) and O(1) extra space

-- 
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: zigzag matrix

2011-10-03 Thread Rahul Verma
we can achieve the zigzag form of the matrix by performing below steps:

int i=1,j=1;

For(i=0;im+n-1;i++)

{

If(in) then j increases upto the value of i

Elseif (i=n  i=m) j increases upto value of m

Elseif(im) j increases upto value of n+m-i. 

}


*For e.g*

*for a 4X6 matrix*

*Input:*

1 2 3 4 5 6 

7 8 9 10 11 12

13 14 15 16 17 18

19 20 21 22 23 24

*Output:*

1

7 2

13 8 3

19 14 9 4 

20 15 10 5

21 16 11 6

22 17 12

23 18

24

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/_j3lxnLAnzQJ.
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: zigzag matrix

2011-10-03 Thread Rahul Verma
@Hatta 

Thanks a lot dear.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/jCx1kM6n4RwJ.
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: Urgent sol needed

2011-10-03 Thread Ankur Garg
Many times this problem has been discussed ..Please check the archives yaar
:(


On Mon, Oct 3, 2011 at 11:39 PM, Shruti Gupta shruti.gupt...@gmail.comwrote:

 I had inserted 0 instead of 1 The corrected code will be:
  public static void setZeros(int[][] matrix) {
int[] row = new int[matrix.length];
int[] column = new int[matrix[0].length];
// Store the row and column index with value 0
  for (int i = 0; i  matrix.length; i++) {
 for (int j = 0; j  matrix[0].length;j++) {
 if (matrix[i][j] == 1) {
   row[i] = 1;
   column[j] = 1;
   }
   }

  }

   // Set arr[i][j] to 0 if either row i or column j has a 0
for (int i = 0; i  matrix.length; i++) {
 for (int j = 0; j  matrix[0].length; j++) {
 if ((row[i] == 1 || column[j] == 1)) {
matrix[i][j] = 1;
 }
   }
   }

 On Oct 3, 11:06 pm, Shruti Gupta shruti.gupt...@gmail.com wrote:
  Hi!
  A effecient way to solve the problem in O(1) space is by making use of
  the fact that instead of keeping track of which cell has a 0, we can
  just know which row or column has zero, as eventually that row/col
  will become 0. The code looks like this:
 
  public static void setZeros(int[][] matrix) {
int[] row = new int[matrix.length];
int[] column = new int[matrix[0].length];
// Store the row and column index with value 0
  for (int i = 0; i  matrix.length; i++) {
 for (int j = 0; j  matrix[0].length;j++) {
 if (matrix[i][j] == 0) {
   row[i] = 1;
   column[j] = 1;
   }
   }
 
  }
 
   // Set arr[i][j] to 0 if either row i or column j has a 0
for (int i = 0; i  matrix.length; i++) {
 for (int j = 0; j  matrix[0].length; j++) {
 if ((row[i] == 1 || column[j] == 1)) {
matrix[i][j] = 0;
 }
   }
   }
 
  Thus there is no extra space taken.
 
  Shruti
 
  On Oct 3, 12:27 am, rahul sharma rahul23111...@gmail.com wrote:
 
 
 
 
 
 
 
   nput is a matrix of size n x m of 0s and 1s.
 
   eg:
   1 0 0 1
   0 0 1 0
   0 0 0 0
 
   If a location has 1; make all the elements of that row and column = 1.
 eg
 
   1 1 1 1
   1 1 1 1
   1 0 1 1
 
   Solution should be with Time complexity = O(n*m) and O(1) extra space

 --
 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] rise and fall of power

2011-10-03 Thread g4ur4v
can anyone please help me on how to approach this problem=
http://www.codechef.com/problems/MARCHA4

-- 
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] rise and fall of power

2011-10-03 Thread Ankur Garg
Keep an array to store multiplication of numbers like for input

9 3
U have to compute 9^9

So an array to store the digits and do simple multiplication like 9*9  will
give 81 so Array will have 81

then 81*9  729  ..so on

Then output the first k digits and last k digits of the array

Any1 having a better solution ?

On Mon, Oct 3, 2011 at 11:48 PM, g4ur4v gauravyadav1...@gmail.com wrote:

 can anyone please help me on how to approach this problem=
 http://www.codechef.com/problems/MARCHA4

 --
 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] New Group For Practicing and Learning Efficient Ways of Coding

2011-10-03 Thread DIVIJ WADHAWAN
yeah , and you have posted a really gud problem there :)

On Mon, Oct 3, 2011 at 7:04 PM, gaurav yadav gauravyadav1...@gmail.comwrote:

 I think once the questions are posted more peolpe will join in...

 --
 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] rise and fall of power

2011-10-03 Thread gaurav yadav
since 1 ≤ *n* ≤ 109

so for n=10^9  you would need an array of size (10^9)^(10^9) which is not
possible..
so your approach wont 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.



Re: [algogeeks] IF ANYONE have c# 2008 or 2010 black book plz mail reply ASAP....

2011-10-03 Thread DIVIJ WADHAWAN
Download visual studio 2010

On Mon, Oct 3, 2011 at 10:19 PM, Deoki Nandan deok...@gmail.com wrote:

 Thanx in advance

 --
 **With Regards
 Deoki Nandan Vishwakarma

 *
 *

  --
 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] New Group For Practicing and Learning Efficient Ways of Coding

2011-10-03 Thread Rahul Verma
@shady

we need moderators to stop spamming and to restrict the no. of problems

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/gArbDhccZG8J.
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: Urgent sol needed

2011-10-03 Thread rahul sharma
@shruti ...u have used 2 arrays row n col extra?

On Mon, Oct 3, 2011 at 11:47 PM, Ankur Garg ankurga...@gmail.com wrote:

 Many times this problem has been discussed ..Please check the archives yaar
 :(



 On Mon, Oct 3, 2011 at 11:39 PM, Shruti Gupta shruti.gupt...@gmail.comwrote:

 I had inserted 0 instead of 1 The corrected code will be:
  public static void setZeros(int[][] matrix) {
int[] row = new int[matrix.length];
int[] column = new int[matrix[0].length];
// Store the row and column index with value 0
  for (int i = 0; i  matrix.length; i++) {
 for (int j = 0; j  matrix[0].length;j++) {
 if (matrix[i][j] == 1) {
   row[i] = 1;
   column[j] = 1;
   }
   }

  }

   // Set arr[i][j] to 0 if either row i or column j has a 0
for (int i = 0; i  matrix.length; i++) {
 for (int j = 0; j  matrix[0].length; j++) {
 if ((row[i] == 1 || column[j] == 1)) {
matrix[i][j] = 1;
 }
   }
   }

 On Oct 3, 11:06 pm, Shruti Gupta shruti.gupt...@gmail.com wrote:
  Hi!
  A effecient way to solve the problem in O(1) space is by making use of
  the fact that instead of keeping track of which cell has a 0, we can
  just know which row or column has zero, as eventually that row/col
  will become 0. The code looks like this:
 
  public static void setZeros(int[][] matrix) {
int[] row = new int[matrix.length];
int[] column = new int[matrix[0].length];
// Store the row and column index with value 0
  for (int i = 0; i  matrix.length; i++) {
 for (int j = 0; j  matrix[0].length;j++) {
 if (matrix[i][j] == 0) {
   row[i] = 1;
   column[j] = 1;
   }
   }
 
  }
 
   // Set arr[i][j] to 0 if either row i or column j has a 0
for (int i = 0; i  matrix.length; i++) {
 for (int j = 0; j  matrix[0].length; j++) {
 if ((row[i] == 1 || column[j] == 1)) {
matrix[i][j] = 0;
 }
   }
   }
 
  Thus there is no extra space taken.
 
  Shruti
 
  On Oct 3, 12:27 am, rahul sharma rahul23111...@gmail.com wrote:
 
 
 
 
 
 
 
   nput is a matrix of size n x m of 0s and 1s.
 
   eg:
   1 0 0 1
   0 0 1 0
   0 0 0 0
 
   If a location has 1; make all the elements of that row and column = 1.
 eg
 
   1 1 1 1
   1 1 1 1
   1 0 1 1
 
   Solution should be with Time complexity = O(n*m) and O(1) extra space

 --
 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: oracle finance questions

2011-10-03 Thread Rahul Tiwari
colg ?  pkg ???

On Oct 3, 7:36 pm, amit kannaujiya amitkannaujiyan...@gmail.com
wrote:
 if any one know  regarding oracle finance online test, plz post type of
 questions asked in online test .

-- 
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: rise and fall of power

2011-10-03 Thread sunny agrawal
For Last K Gene has posted the right Approach.
For First K
Hint : Logarithms log(N^N) = NlgN

On Tue, Oct 4, 2011 at 1:14 AM, Gene gene.ress...@gmail.com wrote:

 I have not done this, so I'm not sure.  But there are some tricks.

 You can first break up the computation to exploit repeated squaring.
 Rather than n-1 multiplications, you can get away with log_2 n by
 computing

 n_1 = n^2
 n_2 = n_1^2
 n_3 = n_2^2
 so that n_i = n^{2^i}
 for i=1..N where n_N = n and n_{N+1}  n

 Let b_i be the i'th bit of n.

 Then n^n = product_{ i | b_i = 1 } ( n_i )

 Now as you say you can't afford to do the full multiply.  So you'll
 need two arbitrary precision multiplication algorithms keeping k
 digits of precision each.  The first is easy.  Compute n^n as above
 modulo 10^k (always throwing away higher order digits) to get the last
 k digits.

 The high order digits is the tricky part.  I think the basic idea is
 to implement floating point yourself.  I.e. keep k+some extra digits
 of mantissa plus an exponent to show where the decimal place is.  The
 problem is you always need to keep enough extra digits beyond k to be
 sure rounding up won't affect to top k.  There should be simple
 algorithm to determine when you can stop.

 Or you can take a chance and count on the fact that the probability of
 carry out is limited for each digit, so with about 30 extra digits the
 chances are pretty close to zero.


 On Oct 3, 8:18 pm, g4ur4v gauravyadav1...@gmail.com wrote:
  can anyone please help me on how to approach this problem=
 http://www.codechef.com/problems/MARCHA4

 --
 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.




-- 
Sunny Aggrawal
B.Tech. V year,CSI
Indian Institute Of Technology,Roorkee

-- 
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] Array Problem??

2011-10-03 Thread Vikram Singh
Given an array say A=(4,3,1,2). An array B is formed out of this in
such a way that B[i] = no. of elements in A, occuring on rhs of A[i],
which are less then A[i].
eg.for the A given, B is (3,2,0,0).
Here A of length n only contains elements from 1 to n that too
distinct..
Now the problem is:
1). You are given with any such A. Find out corresponding B?

2). You are given with any such B. Find out corresponding A?

Please provide solution in O(n),if possible??

-- 
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: string compress/expand

2011-10-03 Thread Ankur Garg
Code for Compression

I am doing it inplace

void convert(char* s,int len){
int i=0;
int count=1;
int index=1; //*maintain the index where number is to be added*
for(i=1;i=len;i++){
   if(s[i]==s[i-1])
   count++;
   else{
   s[index-1]=s[i-1];*//put the char first like a3abbb . then this
step converts it into a3*
   s[index]= (count+'0');/*/convert the count integer into char  so
it becomes a3b4bb*
   count=1;
   index = index+2;
   }
}
s[index-1]='\0'*;//terminate the string* *(a3b4bb will become a3b4)*
}

On Mon, Oct 3, 2011 at 12:12 PM, rahul sharma rahul23111...@gmail.comwrote:

 check my code for compression..

 check if it is ok
 abc i/p
 o/p abc

 means if character has no count.but still present in string it is its only
 occurance.plz check that code...

 #includeiostream.h
 #includeconio.h
 int main()
 {
 cout\nenter the string;
 char str[30];
 cinstr;
 int c=1;
 for(int i=0;str[i];i++)
 {
 if(str[i+1]='0'  str[i+1]='9')
 {
 c=c+(str[i+1]-'0');
 for(int j=1;jc;j++)
 coutstr[i];
   i++;

 }

else
coutstr[i];
c=1;


 }

 getch();

}



 On Mon, Oct 3, 2011 at 12:08 PM, Rahul Verma rahulverma@gmail.comwrote:

 @rahul sharma

 for that you have to check that string is alphanumeric or not. if it is
 alphanumeric then you have to call the function exapansion else you have to
 call the compression function.

 and

 if the desired output for *abc *is *a1b1c1* then you have to call the 
 *exapnsion
 function* or if the desired output is *abc* then you have to add a
 feature in the *compression function* i.e. in output the string have to
 omit the 1's

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/8olzJ_YJVWMJ.

 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: Array Problem??

2011-10-03 Thread Abraham
Hi Vikram!
Obviously The naivest solution is O(n2). Could you give a hint for
this problem?


On Oct 3, 4:39 pm, Vikram Singh singhvikram...@gmail.com wrote:
 Given an array say A=(4,3,1,2). An array B is formed out of this in
 such a way that B[i] = no. of elements in A, occuring on rhs of A[i],
 which are less then A[i].
 eg.for the A given, B is (3,2,0,0).
 Here A of length n only contains elements from 1 to n that too
 distinct..
 Now the problem is:
 1). You are given with any such A. Find out corresponding B?

 2). You are given with any such B. Find out corresponding A?

 Please provide solution in O(n),if possible??

-- 
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: string compress/expand

2011-10-03 Thread Anil Arya
compression
#includestdio.h
#includestring.h
#includestdlib.h
#define MAX_RLEN 50

/* Returns the Run Length Encoded string for the
   source string src */
char *encode(char *src)
{
  int rLen;
  char count[MAX_RLEN];
  int len = strlen(src);

  /* If all characters in the source string are different,
then size of destination string would be twice of input string.
For example if the src is abcd, then dest would be a1b1c1
For other inputs, size would be less than twice.  */
  char *dest = (char *)malloc(sizeof(char)*(len*2 + 1));

  int i, j = 0, k;

  /* traverse the input string one by one */
  for(i = 0; i  len; i++)
  {

/* Copy the first occurrence of the new character */
dest[j++] = src[i];

/* Count the number of occurrences of the new character */
rLen = 1;
while(i + 1  len  src[i] == src[i+1])
{
  rLen++;
  i++;
}

/* Store rLen in a character array count[] */
sprintf(count, %d, rLen);

/* Copy the count[] to destination */
for(k = 0; *(count+k); k++, j++)
{
  dest[j] = count[k];
}
  }

  /*terminate the destination string */
  dest[j] = '\0';
  return dest;
}

/*driver program to test above function */
int main()
{
  char str[] = geeksforgeeks;
  char *res = encode(str);
  printf(%s, res);
  getchar();
}

Time Complexity: O(n

On 10/4/11, Ankur Garg ankurga...@gmail.com wrote:
 Code for Compression

 I am doing it inplace

 void convert(char* s,int len){
 int i=0;
 int count=1;
 int index=1; //*maintain the index where number is to be added*
 for(i=1;i=len;i++){
if(s[i]==s[i-1])
count++;
else{
s[index-1]=s[i-1];*//put the char first like a3abbb . then this
 step converts it into a3*
s[index]= (count+'0');/*/convert the count integer into char  so
 it becomes a3b4bb*
count=1;
index = index+2;
}
 }
 s[index-1]='\0'*;//terminate the string* *(a3b4bb will become a3b4)*
 }

 On Mon, Oct 3, 2011 at 12:12 PM, rahul sharma
 rahul23111...@gmail.comwrote:

 check my code for compression..

 check if it is ok
 abc i/p
 o/p abc

 means if character has no count.but still present in string it is its only
 occurance.plz check that code...

 #includeiostream.h
 #includeconio.h
 int main()
 {
 cout\nenter the string;
 char str[30];
 cinstr;
 int c=1;
 for(int i=0;str[i];i++)
 {
 if(str[i+1]='0'  str[i+1]='9')
 {
 c=c+(str[i+1]-'0');
 for(int j=1;jc;j++)
 coutstr[i];
   i++;

 }

else
coutstr[i];
c=1;


 }

 getch();

}



 On Mon, Oct 3, 2011 at 12:08 PM, Rahul Verma
 rahulverma@gmail.comwrote:

 @rahul sharma

 for that you have to check that string is alphanumeric or not. if it is
 alphanumeric then you have to call the function exapansion else you have
 to
 call the compression function.

 and

 if the desired output for *abc *is *a1b1c1* then you have to call the
 *exapnsion
 function* or if the desired output is *abc* then you have to add a
 feature in the *compression function* i.e. in output the string have to
 omit the 1's

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/8olzJ_YJVWMJ.

 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.




-- 
*Anil  Arya,
Computer Science *
*Motilal Nehru National Institute of Technology,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: string compress/expand

2011-10-03 Thread rahul sharma
plz run my code for test i/p:-

#includeiostream.h
#includeconio.h
int main()
{
cout\nenter the string;
char str[30];
cinstr;
int c=1;

int index=0;
int i;
for(i=0;str[i];i++)
{

   //cout check string str;
 //  getch();
 if(str[i]!=str[i+1])
 {


 // cout\n string at index vairbale str[i];

  str[index]=str[i];

 if(c1)
 {
//cout count is c;

  //  cout\n string at index+1 vairbale c;
//getch();

  //  cout here m i str;

 str[index+1]=c+'0';

 index++;
 }
 index++;
c=1;

 }
 else
 c++;




}
//cout index at end index;
str[index]=str[i];



  coutstr;
getch();

   }
dont look for prog...just give i/p n check that its doing inplaee
compression thnx in advance...reply asap

On Tue, Oct 4, 2011 at 4:39 AM, Ankur Garg ankurga...@gmail.com wrote:

 Code for Compression

 I am doing it inplace

 void convert(char* s,int len){
 int i=0;
 int count=1;
 int index=1; //*maintain the index where number is to be added*
 for(i=1;i=len;i++){
if(s[i]==s[i-1])
count++;
else{
s[index-1]=s[i-1];*//put the char first like a3abbb . then this
 step converts it into a3*
s[index]= (count+'0');/*/convert the count integer into char
 so it becomes a3b4bb*
count=1;
index = index+2;
}
 }
 s[index-1]='\0'*;//terminate the string* *(a3b4bb will become a3b4)*

 }

 On Mon, Oct 3, 2011 at 12:12 PM, rahul sharma rahul23111...@gmail.comwrote:

 check my code for compression..

 check if it is ok
 abc i/p
 o/p abc

 means if character has no count.but still present in string it is its only
 occurance.plz check that code...

 #includeiostream.h
 #includeconio.h
 int main()
 {
 cout\nenter the string;
 char str[30];
 cinstr;
 int c=1;
 for(int i=0;str[i];i++)
 {
 if(str[i+1]='0'  str[i+1]='9')
 {
 c=c+(str[i+1]-'0');
 for(int j=1;jc;j++)
 coutstr[i];
   i++;

 }

else
coutstr[i];
c=1;


 }

 getch();

}



 On Mon, Oct 3, 2011 at 12:08 PM, Rahul Verma rahulverma@gmail.comwrote:

 @rahul sharma

 for that you have to check that string is alphanumeric or not. if it is
 alphanumeric then you have to call the function exapansion else you have to
 call the compression function.

 and

 if the desired output for *abc *is *a1b1c1* then you have to call the 
 *exapnsion
 function* or if the desired output is *abc* then you have to add a
 feature in the *compression function* i.e. in output the string have to
 omit the 1's

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/8olzJ_YJVWMJ.

 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.


-- 
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: Array Problem??

2011-10-03 Thread DIVIJ WADHAWAN
int B[sizeof(A)];
int k=0 , j ;
for(j=i;jn;j++)
{
 if (A[j]  A[i])
  B[k++]=A[j];
}


On Tue, Oct 4, 2011 at 5:30 AM, Abraham freedomsou...@gmail.com wrote:

 Hi Vikram!
 Obviously The naivest solution is O(n2). Could you give a hint for
 this problem?


 On Oct 3, 4:39 pm, Vikram Singh singhvikram...@gmail.com wrote:
  Given an array say A=(4,3,1,2). An array B is formed out of this in
  such a way that B[i] = no. of elements in A, occuring on rhs of A[i],
  which are less then A[i].
  eg.for the A given, B is (3,2,0,0).
  Here A of length n only contains elements from 1 to n that too
  distinct..
  Now the problem is:
  1). You are given with any such A. Find out corresponding B?
 
  2). You are given with any such B. Find out corresponding A?
 
  Please provide solution in O(n),if possible??

 --
 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: MS question

2011-10-03 Thread Ashish Goel
keep two var row0 and col0 for checking if there is any 0 in row0flag
/col0flag

now walk over elements from 1,1 to n,m and set corresponding entry in 0th
row /column if you hit a zero.

now walk over zeroth column and rwo and set the complete row/col if a 0 is
there in 0th row/col.

after this based on row0flag/col0flag, set oth col/row values to 0.

Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652


On Mon, Oct 3, 2011 at 12:08 PM, rahul sharma rahul23111...@gmail.comwrote:

 yeah it is wrong..i have a solution but uses 0(n+m) space.i need it
 in 0(n*m) tymand o(1) space


 On Mon, Oct 3, 2011 at 11:55 AM, shady sinv...@gmail.com wrote:

 search archives :-/


 On Mon, Oct 3, 2011 at 11:47 AM, pranav agrawal 
 pranav.is.cool.agra...@gmail.com wrote:

 @rahul sharma, i ran this code, it is producing wrong answer :|

 check it,  http://codepad.org/THv1hJq1

 anyone with correct solution?

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/26XU3UBqZ6EJ.

 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.


-- 
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: Array Problem??

2011-10-03 Thread Anup Ghatage
Ummm..
Algorithm:
Start from the right of the array,
make the last element of B to 0,
initialize a variables counter to 0 and max to A[end];

LOOP:
and now move from right to left,
if the next element of the left element  max
increment counter and assign it to that  B[ n - element ] index.
max = that element.
if the next element is smaller, assign 0 and repeat LOOP
if the next element's index is 0, check and exit

\/
 A : ( 4, 3, 1, 2 )
 B : ( 0, 0, 0, 0 )
counter = 0;
max = 2;

\/
 A : ( 4, 3, 1, 2 )
 B : ( 0, 0, 0, 0 )
counter = 1;
max = 2;

\/
 A : ( 4, 3, 1, 2 )
 B : ( 0, 0, 0, 0 )
counter = 2;
max = 2;
3   max i.e. 2
b[n - 3] = counter = b[1] = 2
max = 3;

\/
 A : ( 4, 3, 1, 2 )
 B : ( 0, 0, 0, 0 )
counter = 3;
max = 3;
4   max i.e. 3
b[n - 4] = counter = b[0] = 3

Edge Cases: It shall remain all 0's for all same numbers as well as
ascending numbers.



On Tue, Oct 4, 2011 at 7:13 AM, DIVIJ WADHAWAN divij...@gmail.com wrote:

 int B[sizeof(A)];
 int k=0 , j ;
 for(j=i;jn;j++)
 {
  if (A[j]  A[i])
   B[k++]=A[j];

 }


 On Tue, Oct 4, 2011 at 5:30 AM, Abraham freedomsou...@gmail.com wrote:

 Hi Vikram!
 Obviously The naivest solution is O(n2). Could you give a hint for
 this problem?


 On Oct 3, 4:39 pm, Vikram Singh singhvikram...@gmail.com wrote:
  Given an array say A=(4,3,1,2). An array B is formed out of this in
  such a way that B[i] = no. of elements in A, occuring on rhs of A[i],
  which are less then A[i].
  eg.for the A given, B is (3,2,0,0).
  Here A of length n only contains elements from 1 to n that too
  distinct..
  Now the problem is:
  1). You are given with any such A. Find out corresponding B?
 
  2). You are given with any such B. Find out corresponding A?
 
  Please provide solution in O(n),if possible??

 --
 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] Re: MS question

2011-10-03 Thread rahul sharma
@ashish can u give an xample.plz...i have read a lot archives ...but
cant find in 0(1) spaceu using 2 var only...plz give xample...nended
urgent.thnx

On Tue, Oct 4, 2011 at 7:26 AM, Ashish Goel ashg...@gmail.com wrote:

 keep two var row0 and col0 for checking if there is any 0 in row0flag
 /col0flag

 now walk over elements from 1,1 to n,m and set corresponding entry in 0th
 row /column if you hit a zero.

 now walk over zeroth column and rwo and set the complete row/col if a 0 is
 there in 0th row/col.

 after this based on row0flag/col0flag, set oth col/row values to 0.

 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652



 On Mon, Oct 3, 2011 at 12:08 PM, rahul sharma rahul23111...@gmail.comwrote:

 yeah it is wrong..i have a solution but uses 0(n+m) space.i need
 it in 0(n*m) tymand o(1) space


 On Mon, Oct 3, 2011 at 11:55 AM, shady sinv...@gmail.com wrote:

 search archives :-/


 On Mon, Oct 3, 2011 at 11:47 AM, pranav agrawal 
 pranav.is.cool.agra...@gmail.com wrote:

 @rahul sharma, i ran this code, it is producing wrong answer :|

 check it,  http://codepad.org/THv1hJq1

 anyone with correct solution?

  --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/26XU3UBqZ6EJ.

 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.


  --
 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: why java program has main function named public static void main(..) ?

2011-10-03 Thread Vengadanathan
thanx

On Oct 3, 1:59 pm, siddharam suresh siddharam@gmail.com wrote:
 public for visible to compiler/interpreter.
 static only one main for one class/file/package.
 void return none to compile/interpreter.
 Thank you,
 Sid.







 On Mon, Oct 3, 2011 at 1:35 PM, Vengadanathan fantastic.n...@gmail.com 
 wrote:
  Hello everyone , i recently attended a mock interview kept by one of
  my alumni , i was asked the following questions ,
  Question asked : What language JVM is written ?
  I answerd : In c ...

  correct then

  Question asked : why java main function is declared as public static void
  main() ?
  I answerd :
  main() can be accessed by other classes so it is declared public , and
  by declaring static the jvm can call the main function directly by
  classname.main(..) without creating a object ..
  But they asked me in turn ,
  Why would main function called and used by other classes ?
  JVM is written is c , why does then it call classname.main() (oops is not
  supported in c) while executing a java program instead it can directly
  traverse through the byte code and execute the main function

  I answerd  : 
  can any one please give explanation / answer for the questions they asked
  ... thanx in advance .

  --
  You received this message because you are subscribed to the Google Groups
  Algorithm Geeks group.
  To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/a9PWhQjSnvcJ.
  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: MS question

2011-10-03 Thread Ashish Goel
1 1 0 1
0 1 1 1
1 1 1 1
1 1 1 0

row0 is true
col0 is true

for (int i=1; in;i++)
for (int j=1;jm;j++)
if (a[i][j] == 0) {a[i][0]=0; a[0][j]=0;}

now after this
1 1 0 0
0 1 1 1
1 1 1 1
0 1 1 0

for (int i=1; in;i++)
  if (a[i][0] ==0) for (int j=1; jm;j++) a[i][j]=0;
for (int j=1; im;j++)
  if (a[0][j] ==0) for (int i=1; in;i++) a[i][j]=0;

after this
1 1 0 0
0 0 0 0
1 1 0 0
0 0 0 0


because of row0 and col0 vars


final output is
0 0 0 0
0 0 0 0
0 1 0 0
0 0 0 0

Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652


On Tue, Oct 4, 2011 at 7:49 AM, rahul sharma rahul23111...@gmail.comwrote:

 @ashish can u give an xample.plz...i have read a lot archives ...but
 cant find in 0(1) spaceu using 2 var only...plz give xample...nended
 urgent.thnx


 On Tue, Oct 4, 2011 at 7:26 AM, Ashish Goel ashg...@gmail.com wrote:

 keep two var row0 and col0 for checking if there is any 0 in row0flag
 /col0flag

 now walk over elements from 1,1 to n,m and set corresponding entry in 0th
 row /column if you hit a zero.

 now walk over zeroth column and rwo and set the complete row/col if a 0 is
 there in 0th row/col.

 after this based on row0flag/col0flag, set oth col/row values to 0.

 Best Regards
  Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652



 On Mon, Oct 3, 2011 at 12:08 PM, rahul sharma rahul23111...@gmail.comwrote:

 yeah it is wrong..i have a solution but uses 0(n+m) space.i need
 it in 0(n*m) tymand o(1) space


 On Mon, Oct 3, 2011 at 11:55 AM, shady sinv...@gmail.com wrote:

 search archives :-/


 On Mon, Oct 3, 2011 at 11:47 AM, pranav agrawal 
 pranav.is.cool.agra...@gmail.com wrote:

 @rahul sharma, i ran this code, it is producing wrong answer :|

 check it,  http://codepad.org/THv1hJq1

 anyone with correct solution?

  --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/26XU3UBqZ6EJ.

 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.


  --
 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] Re: Array Problem??

2011-10-03 Thread Ashish Goel
7 1 4 5 3 6 2
try for

is it necessary to have  elements within 1-n range?

Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652


On Tue, Oct 4, 2011 at 7:36 AM, Anup Ghatage ghat...@gmail.com wrote:

 Ummm..
 Algorithm:
 Start from the right of the array,
 make the last element of B to 0,
 initialize a variables counter to 0 and max to A[end];

 LOOP:
 and now move from right to left,
 if the next element of the left element  max
 increment counter and assign it to that  B[ n - element ] index.
 max = that element.
 if the next element is smaller, assign 0 and repeat LOOP
 if the next element's index is 0, check and exit

 \/
  A : ( 4, 3, 1, 2 )
  B : ( 0, 0, 0, 0 )
 counter = 0;
 max = 2;

 \/
  A : ( 4, 3, 1, 2 )
  B : ( 0, 0, 0, 0 )
 counter = 1;
 max = 2;

 \/
  A : ( 4, 3, 1, 2 )
  B : ( 0, 0, 0, 0 )
 counter = 2;
 max = 2;
 3   max i.e. 2
 b[n - 3] = counter = b[1] = 2
 max = 3;

 \/
  A : ( 4, 3, 1, 2 )
  B : ( 0, 0, 0, 0 )
 counter = 3;
 max = 3;
 4   max i.e. 3
 b[n - 4] = counter = b[0] = 3

 Edge Cases: It shall remain all 0's for all same numbers as well as
 ascending numbers.




 On Tue, Oct 4, 2011 at 7:13 AM, DIVIJ WADHAWAN divij...@gmail.com wrote:

 int B[sizeof(A)];
 int k=0 , j ;
 for(j=i;jn;j++)
 {
  if (A[j]  A[i])
   B[k++]=A[j];

 }


 On Tue, Oct 4, 2011 at 5:30 AM, Abraham freedomsou...@gmail.com wrote:

 Hi Vikram!
 Obviously The naivest solution is O(n2). Could you give a hint for
 this problem?


 On Oct 3, 4:39 pm, Vikram Singh singhvikram...@gmail.com wrote:
  Given an array say A=(4,3,1,2). An array B is formed out of this in
  such a way that B[i] = no. of elements in A, occuring on rhs of A[i],
  which are less then A[i].
  eg.for the A given, B is (3,2,0,0).
  Here A of length n only contains elements from 1 to n that too
  distinct..
  Now the problem is:
  1). You are given with any such A. Find out corresponding B?
 
  2). You are given with any such B. Find out corresponding A?
 
  Please provide solution in O(n),if possible??

 --
 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: MS question

2011-10-03 Thread rahul sharma
row0 and col0 initilayy true coz we have 0 in 0 row???or these r default
values?

On Tue, Oct 4, 2011 at 8:07 AM, Ashish Goel ashg...@gmail.com wrote:

 1 1 0 1
 0 1 1 1
 1 1 1 1
 1 1 1 0

 row0 is true
 col0 is true

 for (int i=1; in;i++)
 for (int j=1;jm;j++)
 if (a[i][j] == 0) {a[i][0]=0; a[0][j]=0;}

 now after this
 1 1 0 0
 0 1 1 1
 1 1 1 1
 0 1 1 0

 for (int i=1; in;i++)
   if (a[i][0] ==0) for (int j=1; jm;j++) a[i][j]=0;
 for (int j=1; im;j++)
   if (a[0][j] ==0) for (int i=1; in;i++) a[i][j]=0;

 after this
 1 1 0 0
 0 0 0 0
 1 1 0 0
 0 0 0 0


 because of row0 and col0 vars


 final output is
 0 0 0 0
 0 0 0 0
 0 1 0 0
 0 0 0 0

 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652


 On Tue, Oct 4, 2011 at 7:49 AM, rahul sharma rahul23111...@gmail.comwrote:

 @ashish can u give an xample.plz...i have read a lot archives ...but
 cant find in 0(1) spaceu using 2 var only...plz give xample...nended
 urgent.thnx


 On Tue, Oct 4, 2011 at 7:26 AM, Ashish Goel ashg...@gmail.com wrote:

 keep two var row0 and col0 for checking if there is any 0 in row0flag
 /col0flag

 now walk over elements from 1,1 to n,m and set corresponding entry in 0th
 row /column if you hit a zero.

 now walk over zeroth column and rwo and set the complete row/col if a 0
 is there in 0th row/col.

 after this based on row0flag/col0flag, set oth col/row values to 0.

 Best Regards
  Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652



 On Mon, Oct 3, 2011 at 12:08 PM, rahul sharma 
 rahul23111...@gmail.comwrote:

 yeah it is wrong..i have a solution but uses 0(n+m) space.i need
 it in 0(n*m) tymand o(1) space


 On Mon, Oct 3, 2011 at 11:55 AM, shady sinv...@gmail.com wrote:

 search archives :-/


 On Mon, Oct 3, 2011 at 11:47 AM, pranav agrawal 
 pranav.is.cool.agra...@gmail.com wrote:

 @rahul sharma, i ran this code, it is producing wrong answer :|

 check it,  http://codepad.org/THv1hJq1

 anyone with correct solution?

  --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/26XU3UBqZ6EJ.

 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.


  --
 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.


-- 
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: MS question

2011-10-03 Thread Ashish Goel
0 in 0th row as well as 0 in 0th col and hence true


Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652


On Tue, Oct 4, 2011 at 8:28 AM, rahul sharma rahul23111...@gmail.comwrote:

 row0 and col0 initilayy true coz we have 0 in 0 row???or these r default
 values?


 On Tue, Oct 4, 2011 at 8:07 AM, Ashish Goel ashg...@gmail.com wrote:

 1 1 0 1
 0 1 1 1
 1 1 1 1
 1 1 1 0

 row0 is true
 col0 is true

 for (int i=1; in;i++)
 for (int j=1;jm;j++)
 if (a[i][j] == 0) {a[i][0]=0; a[0][j]=0;}

 now after this
 1 1 0 0
 0 1 1 1
 1 1 1 1
 0 1 1 0

 for (int i=1; in;i++)
   if (a[i][0] ==0) for (int j=1; jm;j++) a[i][j]=0;
 for (int j=1; im;j++)
   if (a[0][j] ==0) for (int i=1; in;i++) a[i][j]=0;

 after this
 1 1 0 0
 0 0 0 0
 1 1 0 0
 0 0 0 0


 because of row0 and col0 vars


 final output is
 0 0 0 0
 0 0 0 0
 0 1 0 0
 0 0 0 0

 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652


 On Tue, Oct 4, 2011 at 7:49 AM, rahul sharma rahul23111...@gmail.comwrote:

 @ashish can u give an xample.plz...i have read a lot archives ...but
 cant find in 0(1) spaceu using 2 var only...plz give xample...nended
 urgent.thnx


 On Tue, Oct 4, 2011 at 7:26 AM, Ashish Goel ashg...@gmail.com wrote:

 keep two var row0 and col0 for checking if there is any 0 in row0flag
 /col0flag

 now walk over elements from 1,1 to n,m and set corresponding entry in
 0th row /column if you hit a zero.

 now walk over zeroth column and rwo and set the complete row/col if a 0
 is there in 0th row/col.

 after this based on row0flag/col0flag, set oth col/row values to 0.

 Best Regards
  Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652



 On Mon, Oct 3, 2011 at 12:08 PM, rahul sharma 
 rahul23111...@gmail.comwrote:

 yeah it is wrong..i have a solution but uses 0(n+m) space.i
 need it in 0(n*m) tymand o(1) space


 On Mon, Oct 3, 2011 at 11:55 AM, shady sinv...@gmail.com wrote:

 search archives :-/


 On Mon, Oct 3, 2011 at 11:47 AM, pranav agrawal 
 pranav.is.cool.agra...@gmail.com wrote:

 @rahul sharma, i ran this code, it is producing wrong answer :|

 check it,  http://codepad.org/THv1hJq1

 anyone with correct solution?

  --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/26XU3UBqZ6EJ.

 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.


  --
 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.


  --
 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, 

Re: [algogeeks] Re: MS question

2011-10-03 Thread rahul sharma
so we shoul d aslo add loop at the top to find only for firrst row and
column the initial values

On Tue, Oct 4, 2011 at 8:30 AM, Ashish Goel ashg...@gmail.com wrote:

 0 in 0th row as well as 0 in 0th col and hence true


 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652


 On Tue, Oct 4, 2011 at 8:28 AM, rahul sharma rahul23111...@gmail.comwrote:

 row0 and col0 initilayy true coz we have 0 in 0 row???or these r default
 values?


 On Tue, Oct 4, 2011 at 8:07 AM, Ashish Goel ashg...@gmail.com wrote:

 1 1 0 1
 0 1 1 1
 1 1 1 1
 1 1 1 0

 row0 is true
 col0 is true

 for (int i=1; in;i++)
 for (int j=1;jm;j++)
 if (a[i][j] == 0) {a[i][0]=0; a[0][j]=0;}

 now after this
 1 1 0 0
 0 1 1 1
 1 1 1 1
 0 1 1 0

 for (int i=1; in;i++)
   if (a[i][0] ==0) for (int j=1; jm;j++) a[i][j]=0;
 for (int j=1; im;j++)
   if (a[0][j] ==0) for (int i=1; in;i++) a[i][j]=0;

 after this
 1 1 0 0
 0 0 0 0
 1 1 0 0
 0 0 0 0


 because of row0 and col0 vars


 final output is
 0 0 0 0
 0 0 0 0
 0 1 0 0
 0 0 0 0

 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652


 On Tue, Oct 4, 2011 at 7:49 AM, rahul sharma rahul23111...@gmail.comwrote:

 @ashish can u give an xample.plz...i have read a lot archives ...but
 cant find in 0(1) spaceu using 2 var only...plz give xample...nended
 urgent.thnx


 On Tue, Oct 4, 2011 at 7:26 AM, Ashish Goel ashg...@gmail.com wrote:

 keep two var row0 and col0 for checking if there is any 0 in row0flag
 /col0flag

 now walk over elements from 1,1 to n,m and set corresponding entry in
 0th row /column if you hit a zero.

 now walk over zeroth column and rwo and set the complete row/col if a 0
 is there in 0th row/col.

 after this based on row0flag/col0flag, set oth col/row values to 0.

 Best Regards
  Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652



 On Mon, Oct 3, 2011 at 12:08 PM, rahul sharma rahul23111...@gmail.com
  wrote:

 yeah it is wrong..i have a solution but uses 0(n+m) space.i
 need it in 0(n*m) tymand o(1) space


 On Mon, Oct 3, 2011 at 11:55 AM, shady sinv...@gmail.com wrote:

 search archives :-/


 On Mon, Oct 3, 2011 at 11:47 AM, pranav agrawal 
 pranav.is.cool.agra...@gmail.com wrote:

 @rahul sharma, i ran this code, it is producing wrong answer :|

 check it,  http://codepad.org/THv1hJq1

 anyone with correct solution?

  --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/26XU3UBqZ6EJ.

 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.


  --
 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.


  --
 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 

Re: [algogeeks] IF ANYONE have c# 2008 or 2010 black book plz mail reply ASAP....

2011-10-03 Thread Deoki Nandan
I have visual studio 2010 I need book

On 4 October 2011 00:05, DIVIJ WADHAWAN divij...@gmail.com wrote:

 Download visual studio 2010

 On Mon, Oct 3, 2011 at 10:19 PM, Deoki Nandan deok...@gmail.com wrote:

 Thanx in advance

 --
 **With Regards
 Deoki Nandan Vishwakarma

 *
 *

  --
 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.




-- 
**With Regards
Deoki Nandan Vishwakarma
IIT ROORKEE
9760340784

*
*

-- 
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: MS question

2011-10-03 Thread rahul sharma
got it..thnx yr

On Tue, Oct 4, 2011 at 8:34 AM, rahul sharma rahul23111...@gmail.comwrote:

 so we shoul d aslo add loop at the top to find only for firrst row and
 column the initial values


 On Tue, Oct 4, 2011 at 8:30 AM, Ashish Goel ashg...@gmail.com wrote:

 0 in 0th row as well as 0 in 0th col and hence true


 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652


 On Tue, Oct 4, 2011 at 8:28 AM, rahul sharma rahul23111...@gmail.comwrote:

 row0 and col0 initilayy true coz we have 0 in 0 row???or these r default
 values?


 On Tue, Oct 4, 2011 at 8:07 AM, Ashish Goel ashg...@gmail.com wrote:

 1 1 0 1
 0 1 1 1
 1 1 1 1
 1 1 1 0

 row0 is true
 col0 is true

 for (int i=1; in;i++)
 for (int j=1;jm;j++)
 if (a[i][j] == 0) {a[i][0]=0; a[0][j]=0;}

 now after this
 1 1 0 0
 0 1 1 1
 1 1 1 1
 0 1 1 0

 for (int i=1; in;i++)
   if (a[i][0] ==0) for (int j=1; jm;j++) a[i][j]=0;
 for (int j=1; im;j++)
   if (a[0][j] ==0) for (int i=1; in;i++) a[i][j]=0;

 after this
 1 1 0 0
 0 0 0 0
 1 1 0 0
 0 0 0 0


 because of row0 and col0 vars


 final output is
 0 0 0 0
 0 0 0 0
 0 1 0 0
 0 0 0 0

 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652


 On Tue, Oct 4, 2011 at 7:49 AM, rahul sharma 
 rahul23111...@gmail.comwrote:

 @ashish can u give an xample.plz...i have read a lot archives
 ...but cant find in 0(1) spaceu using 2 var only...plz give
 xample...nended urgent.thnx


 On Tue, Oct 4, 2011 at 7:26 AM, Ashish Goel ashg...@gmail.com wrote:

 keep two var row0 and col0 for checking if there is any 0 in row0flag
 /col0flag

 now walk over elements from 1,1 to n,m and set corresponding entry in
 0th row /column if you hit a zero.

 now walk over zeroth column and rwo and set the complete row/col if a
 0 is there in 0th row/col.

 after this based on row0flag/col0flag, set oth col/row values to 0.

 Best Regards
  Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652



 On Mon, Oct 3, 2011 at 12:08 PM, rahul sharma 
 rahul23111...@gmail.com wrote:

 yeah it is wrong..i have a solution but uses 0(n+m) space.i
 need it in 0(n*m) tymand o(1) space


 On Mon, Oct 3, 2011 at 11:55 AM, shady sinv...@gmail.com wrote:

 search archives :-/


 On Mon, Oct 3, 2011 at 11:47 AM, pranav agrawal 
 pranav.is.cool.agra...@gmail.com wrote:

 @rahul sharma, i ran this code, it is producing wrong answer :|

 check it,  http://codepad.org/THv1hJq1

 anyone with correct solution?

  --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To view this discussion on the web visit
 https://groups.google.com/d/msg/algogeeks/-/26XU3UBqZ6EJ.

 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.


  --
 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.


  --
 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 

Re: [algogeeks] Re: Array Problem??

2011-10-03 Thread Vikram Singh
@ashish: yes it is given that elements are in 1-n range...
@anup: ur sol doesnt work for above case... try to make it general..
@abraham: i hv O(n2) sol, not required, that to of only 1st part...


guys try thinking 2nd part also??


On Tue, Oct 4, 2011 at 8:14 AM, Ashish Goel ashg...@gmail.com wrote:

 7 1 4 5 3 6 2
 try for

 is it necessary to have  elements within 1-n range?

 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652



 On Tue, Oct 4, 2011 at 7:36 AM, Anup Ghatage ghat...@gmail.com wrote:

 Ummm..
 Algorithm:
 Start from the right of the array,
 make the last element of B to 0,
 initialize a variables counter to 0 and max to A[end];

 LOOP:
 and now move from right to left,
 if the next element of the left element  max
 increment counter and assign it to that  B[ n - element ] index.
 max = that element.
 if the next element is smaller, assign 0 and repeat LOOP
 if the next element's index is 0, check and exit

 \/
  A : ( 4, 3, 1, 2 )
  B : ( 0, 0, 0, 0 )
 counter = 0;
 max = 2;

 \/
  A : ( 4, 3, 1, 2 )
  B : ( 0, 0, 0, 0 )
 counter = 1;
 max = 2;

 \/
  A : ( 4, 3, 1, 2 )
  B : ( 0, 0, 0, 0 )
 counter = 2;
 max = 2;
 3   max i.e. 2
 b[n - 3] = counter = b[1] = 2
 max = 3;

 \/
  A : ( 4, 3, 1, 2 )
  B : ( 0, 0, 0, 0 )
 counter = 3;
 max = 3;
 4   max i.e. 3
 b[n - 4] = counter = b[0] = 3

 Edge Cases: It shall remain all 0's for all same numbers as well as
 ascending numbers.




 On Tue, Oct 4, 2011 at 7:13 AM, DIVIJ WADHAWAN divij...@gmail.comwrote:

 int B[sizeof(A)];
 int k=0 , j ;
 for(j=i;jn;j++)
 {
  if (A[j]  A[i])
   B[k++]=A[j];

 }


 On Tue, Oct 4, 2011 at 5:30 AM, Abraham freedomsou...@gmail.com wrote:

 Hi Vikram!
 Obviously The naivest solution is O(n2). Could you give a hint for
 this problem?


 On Oct 3, 4:39 pm, Vikram Singh singhvikram...@gmail.com wrote:
  Given an array say A=(4,3,1,2). An array B is formed out of this in
  such a way that B[i] = no. of elements in A, occuring on rhs of A[i],
  which are less then A[i].
  eg.for the A given, B is (3,2,0,0).
  Here A of length n only contains elements from 1 to n that too
  distinct..
  Now the problem is:
  1). You are given with any such A. Find out corresponding B?
 
  2). You are given with any such B. Find out corresponding A?
 
  Please provide solution in O(n),if possible??

 --
 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.


-- 
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: Array Problem??

2011-10-03 Thread anshu mishra
use segment tree or binary index tree to solve O(nlogn)

-- 
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: Array Problem??

2011-10-03 Thread Vikram Singh
@anshu: pls elaborate... give an example...

On Tue, Oct 4, 2011 at 9:51 AM, anshu mishra anshumishra6...@gmail.comwrote:

 use segment tree or binary index tree to solve O(nlogn)

  --
 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] New Group For Practicing and Learning Efficient Ways of Coding

2011-10-03 Thread Rahul Verma
Hey,
 
I have a suggestion that why we don't have a discussion on some topic for 
full one week and after that we can discuss problems from various 
programming sites and discuss the best solution of the problems..

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/S3FSxSWlnJAJ.
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.