Re: [algogeeks] Re: If any one have algorithms for interviews by adnan aziz ebook... Please mail ...

2011-06-24 Thread murthy.krishn...@gmail.com
yaa If any one has it, can you please mail it to me also

Thanks,

On Fri, Jun 24, 2011 at 2:36 PM, alok kediya alokked...@gmail.com wrote:

 any one downloaded or having link to download link, plz share it with me..
 thanks in advance :)

 Thanks,
 Alok

 On Thu, Jun 23, 2011 at 10:58 PM, Bhavesh agrawal 
 agr.bhav...@gmail.comwrote:

 mail it to me plz..

 agr.bhav...@gmail.com

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


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




-- 
P.V.N.S.S. Krishna Murthy,
Intern at Broadcom Private Limited,
Bangalore,
Contact no:- +919845812996.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Interview Question

2011-04-08 Thread murthy.krishn...@gmail.com
For the second case,

Consider,

A - B - C - NULL

Accor 2 me he has asked to reverse d list to make it as C - A by deleting
B, which can be done like this,

temp-next = temp-next-next; // A-C-NULL
temp-next-next = temp; //A-C-A
temp = temp-next; //C-A-C
temp-next-next = NULL; //C-A-NULL

Correct me, If am wrong

Thanks,



now temp is poiting to
On Fri, Apr 8, 2011 at 2:13 PM, cegprakash cegprak...@gmail.com wrote:

 for the second case it is possible only if the node contains the
 previous node's address. Else there should be data movement

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




-- 
P.V.N.S.S. Krishna Murthy,
Intern at Broadcom Private Limited,
Bangalore,
Contact no:- +919845812996.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Interview Question

2011-04-08 Thread murthy.krishn...@gmail.com
hii,

Small correction

For the second case,

Consider,

A - B - C - NULL

Initially temp is pointing to A.

Accor 2 me he has asked to reverse d list to make it as C - A by deleting
B, which can be done like this,

temp-next = temp-next-next; // A-C-NULL
temp-next-next = temp; //A-C-A
temp = temp-next; //C-A-C
temp-next-next = NULL; //C-A-NULL

Correct me, If am wrong

Thanks,

On Fri, Apr 8, 2011 at 4:47 PM, murthy.krishn...@gmail.com 
murthy.krishn...@gmail.com wrote:

 For the second case,

 Consider,

 A - B - C - NULL

 Accor 2 me he has asked to reverse d list to make it as C - A by deleting
 B, which can be done like this,

 temp-next = temp-next-next; // A-C-NULL
 temp-next-next = temp; //A-C-A
 temp = temp-next; //C-A-C
 temp-next-next = NULL; //C-A-NULL

 Correct me, If am wrong

 Thanks,



 now temp is poiting to
 On Fri, Apr 8, 2011 at 2:13 PM, cegprakash cegprak...@gmail.com wrote:

 for the second case it is possible only if the node contains the
 previous node's address. Else there should be data movement

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




 --
 P.V.N.S.S. Krishna Murthy,
 Intern at Broadcom Private Limited,
 Bangalore,
 Contact no:- +919845812996.




-- 
P.V.N.S.S. Krishna Murthy,
Intern at Broadcom Private Limited,
Bangalore,
Contact no:- +919845812996.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Virtual classes

2011-03-28 Thread murthy.krishn...@gmail.com
hey u can find dat clearly in C++: The complete reference. You can download
dat from here
http://asaha.com/ebook/DOTA5NDk-/C-The-Complete-Reference,-3rd-Edition.pdf

On Tue, Mar 29, 2011 at 12:07 AM, himanshu kansal 
himanshukansal...@gmail.com wrote:

 can u gv any link for reference...???


 On Sat, Mar 26, 2011 at 12:29 PM, D.N.Vishwakarma@IITR 
 deok...@gmail.comwrote:

 *there is vtable known as virtual table which contains addresses of
 virtual functions .
 And there is vptr a pointer that points to vtable of that class space
 occupied by class having virtual function wil be equal to space occupied by
 a pointer * number of virtual functions ..
 I think this if there is any correction please let me  know...
 *
 On Sat, Mar 26, 2011 at 12:00 PM, himanshu kansal 
 himanshukansal...@gmail.com wrote:

 wht is the space occupied by a class in c++ whn it contains a virtual
 fn.
 How are the virtual fn implemented internally by c++...

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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
 IITR MCA
 Mathematics Department
 *

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




-- 
P.V.N.S.S. Krishna Murthy,
Contact no:- +919845812996.

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] SPOJ problem-BRCKTS

2011-03-20 Thread murthy.krishn...@gmail.com
@anurag accor to me the output must be YES, correct me if I am wrong

On Sun, Mar 20, 2011 at 10:40 AM, bharath kannan bharathgo...@gmail.comwrote:

 i thot tat i had some mistake in my code and typed it all over again..
 finally i noticed this :)



 On Sat, Mar 19, 2011 at 12:12 AM, Kunal Patil kp101...@gmail.com wrote:

 Hey..
 I also got into same trouble today...
 I submitted it 6 times..then got bored and de moralised cause i cudnt find
 flaw in code...
 When i read your mail and corresponding sorry mail...it just struck me..I
 also had to print YES and NOand i was printing NO as NoIt
 got ac den...
 :P
 thnx anyway !!!

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] SPOJ problem-BRCKTS

2011-03-20 Thread murthy.krishn...@gmail.com
@bharath yaa now I got the ques, thanx :-)

On Mon, Mar 21, 2011 at 4:47 AM, bharath kannan bharathgo...@gmail.comwrote:

 @murthy:no..the op must be NOits not a valid expression..read the two
 conditions for a valid expression..

 On Sun, Mar 20, 2011 at 8:23 PM, murthy.krishn...@gmail.com 
 murthy.krishn...@gmail.com wrote:

 @anurag accor to me the output must be YES, correct me if I am wrong


 On Sun, Mar 20, 2011 at 10:40 AM, bharath kannan 
 bharathgo...@gmail.comwrote:

 i thot tat i had some mistake in my code and typed it all over again..
 finally i noticed this :)



 On Sat, Mar 19, 2011 at 12:12 AM, Kunal Patil kp101...@gmail.comwrote:

 Hey..
 I also got into same trouble today...
 I submitted it 6 times..then got bored and de moralised cause i cudnt
 find flaw in code...
 When i read your mail and corresponding sorry mail...it just struck
 me..I also had to print YES and NOand i was printing NO as
 NoIt got ac den...
 :P
 thnx anyway !!!

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] SPOJ problem-BRCKTS

2011-03-20 Thread murthy.krishn...@gmail.com
Thanks 2 all

On Mon, Mar 21, 2011 at 9:19 AM, Anurag atri anu.anurag@gmail.comwrote:

 @krishna - yeah as Bharath said that case should give NO , anyways you got
 it now :)


 On Mon, Mar 21, 2011 at 5:50 AM, murthy.krishn...@gmail.com 
 murthy.krishn...@gmail.com wrote:

 @bharath yaa now I got the ques, thanx :-)


 On Mon, Mar 21, 2011 at 4:47 AM, bharath kannan 
 bharathgo...@gmail.comwrote:

 @murthy:no..the op must be NOits not a valid expression..read the two
 conditions for a valid expression..

 On Sun, Mar 20, 2011 at 8:23 PM, murthy.krishn...@gmail.com 
 murthy.krishn...@gmail.com wrote:

 @anurag accor to me the output must be YES, correct me if I am wrong


 On Sun, Mar 20, 2011 at 10:40 AM, bharath kannan 
 bharathgo...@gmail.com wrote:

 i thot tat i had some mistake in my code and typed it all over again..
 finally i noticed this :)



 On Sat, Mar 19, 2011 at 12:12 AM, Kunal Patil kp101...@gmail.comwrote:

 Hey..
 I also got into same trouble today...
 I submitted it 6 times..then got bored and de moralised cause i cudnt
 find flaw in code...
 When i read your mail and corresponding sorry mail...it just struck
 me..I also had to print YES and NOand i was printing NO as
 NoIt got ac den...
 :P
 thnx anyway !!!

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




 --
 Regards
 Anurag Atri

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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: SPOJ problem-BRCKTS

2011-03-19 Thread murthy.krishn...@gmail.com
can any 1 explain why we have 2 use segment trees ??

I am under the impression that in order to distinguish correct bracket
expressions, we can just count the number of left brackets and compare that
with the number of right brackets, if they are equal then it is a correct
bracket expression.

can u please correct me with an example if I am wrong

Thanks,
Krishna.

On Sat, Mar 19, 2011 at 4:13 PM, cegprakash cegprak...@gmail.com wrote:

 could someone plz help me with a pdf for learning segment tree? i
 don't understand the wiki page

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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: Google puzzles

2011-03-18 Thread murthy.krishn...@gmail.com
hey we can do like dis man using trial and error, so start with m = 15, 22,
29 etc. obviuosly we cant start with 8 as n must be greater than 1. I think
u people got the reason for starting with 15(1+14 is divisible by 7),
22(1+21 is divisible by 7) etc.

test for m = 15;

Day 1:- medals = 1+14/7 = 3;
Day 2:- medals = 2 + 10 which is not divisible by 7

test for m = 22;

Day 1:- medals = 1+21/7=4;
Day 2:- medals = 2+16 which is not divisible by 7

test for m = 29;

Day 1:- medals = 1+28/7 = 5;
Day 2:-medals = 2+22 which is not divisible by 7

test for m = 36

Day 1:- medals = 1+35/7=6;
Day 2:- medals = 2+28/7=6;
Day 3:- meadals = 3+21/7 = 6;
Day 4:- medals = 4+ 14/7 = 6;
Day 5:- medals = 5+7/7 = 6;
Day 6:- medals = 6;

So m = 36 and n = 6. Hope I am clear.



On Fri, Mar 18, 2011 at 12:02 PM, bittu shashank7andr...@gmail.com wrote:

 Hi here is the basic approach as we know in a week atmost  7 days ..so
 start with hit and trial

 Total 36 medals were awarded and the contest was for 6 days.

 On day 1: Medals awarded = (1 + 35/7) = 6 : Remaining 30 medals
 On day 2: Medals awarded = (2 + 28/7) = 6 : Remaining 24 medals
 On day 3: Medals awarded = (3 + 21/7) = 6 : Remaining 18 medals
 On day 4: Medals awarded = (4 + 14/7) = 6 : Remaining 12 medals
 On day 5: Medals awarded = (5 +7/7) = 6 : Remaining 6 medals
 On day 6: Medals awarded 6

 Clear and Simple

 Thanks
 Sahshank

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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(amazon microsoft)

2011-03-01 Thread murthy.krishn...@gmail.com
Hii, can you please tell me wat d ques exactly is ??

THanks,
Krishna.

On Wed, Mar 2, 2011 at 9:52 AM, sunny agrawal sunny816.i...@gmail.comwrote:

 @bittu
 Question is about to print entire array in sorted order, not searching an
 element

 On Wed, Mar 2, 2011 at 4:13 AM, bittu shashank7andr...@gmail.com wrote:

 @all after 32  Message Discussion I know Everyone is looking for O(N)
 solution well it seems odd how we can search an element in a O(m*n)
 matrix in O(n)  but answer of this question is given already in the
 question that  all row  column are sorted  so why O(n) solution
 exist   it really matters  play very important role if one will
 think out of boxwell i think inside the box.not outside...lol


 here we go  for O(n) Clean ,Elegant ,Simple   Best Solution as i
 think for this problem


  boolean FindElem(int[][] mat, int elem, int M, int N)
  {
  int row = 0;
  int col = N-1;

  while (row  M  col = 0)
  {

  if (mat[row][col] == elem)//done
  {
return true;
  }
  else if (mat[row][col]  elem) //obvious as all call  are sorted
 because all value in col[j]  col[j+1]  given  test below program for
 searching element 2
  {
  col--;
  }
  else // its all same as all row are sorted  so if element not found
 in a[i][]  then got a[i+1][]  row because all all value in row[i] 
 row[i+1] its given

 {  //
 test below program for searching element 9
 row++;
  }

  }
  return false;

 }

 Working Code https://ideone.com/64HJg

 If u found for any counter test case its failing then plz let me know
 still  f any has  doubt i will try to explain my best


 Thanks  Regards
 Shashank Mani the Best way to escape from The Problem is Solve 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.




 --
 Sunny Aggrawal
 B-Tech IV 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.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Amazon Interview question

2011-02-28 Thread murthy.krishn...@gmail.com
how abt dis guys ??

#include stdio.h
#include string.h
#define MAX 100

int main()
{
int n;
int i;
int j;
int it;
char input[MAX];
char tmp;

scanf(%s,input);

n = strlen(input);

i = j = n/2;

for(it=1; itn-2; it++) {
if(it%2 == 1) {
tmp = input[j];
input[j] = input[it];
input[it] = tmp;
j++;
} else if( it  i ) {
tmp = input[i];
input[i] = input[it];
input[it] = tmp;
} else {
tmp = input[it];
input[it] = input[it+1];
input[it+1] = tmp;
}
}

printf(\n%s\n,input);

return 0;
}

On Mon, Feb 28, 2011 at 8:29 PM, Arpit Sood soodfi...@gmail.com wrote:

 Are there any constraints in the problem, because it seems straight
 forward.

 if number of elements are 2n indexed from 0 to 2n-1

 for i=0 to n-1:
new_array[i*2]=old_array[i];
new_array[i*2+1]=old_array[i+n];

 On Mon, Feb 28, 2011 at 7:41 PM, bittu shashank7andr...@gmail.com wrote:

 @jalaj U needs to clarify becoz what i can say that dat is overwritten
 in ur explanation so we loosing the original  data where we are saving
 when we swapping the elements ur explanation seems to be right but
 little confusing

 @ujjwal  i haven't tested ur code but i think its O(n^2)  then why not
 try for this 20  Line Simple  code of O(n^2)

 Finally we wants O(n) better solution fro this which exist for
 this ???

 #includestring.h

 void swap(char *c,char *p)
 {
  char tmp;
  tmp=*c;
  *c=*p;
  *p=tmp;

 }

 int main (int argc, char const* argv[])
 {
char str[] = 1234abcd;
int i,j;
int len = strlen(str)/2;
//swap str[len-1] and str[len] and so on
for ( i = 0; i  len-1; i += 1) {
for ( j = len-1-i; j = len+i; j += 2)
{
 printf(i=%d j=%d c1=%c \t c2=%c
 \n,i,j,str[j],str[j+1]);
swap(str[j],str[j+1]);
}
}
printf(%s \n, str);
return 0;
 }

 Time Complexcity O(n^2)  O(n) Needed..


 Thanks  Regards
 Shashank  The Best Way to escape From The Problem is Solve 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.



  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] Amazon Online Test

2011-02-23 Thread murthy.krishn...@gmail.com
thanks vinay :-)

On Wed, Feb 23, 2011 at 5:39 PM, vinay reddy gvina...@gmail.com wrote:

 U need to construct a binary tree given only PreOrder traversal with the
 condition that each node has zero or two children.

 On Wed, Feb 23, 2011 at 10:52 AM, murthy.krishn...@gmail.com 
 murthy.krishn...@gmail.com wrote:

 hii vinay,

 can u elaborate the third question

 thanks,
 Krishna

   On Wed, Feb 23, 2011 at 9:34 AM, vinay reddy gvina...@gmail.comwrote:

  Hi Anurag,

 I have taken that online test there were 3 questions ...
 1. given a linked list check if it is a palindrome.
 2.given two sorted arrays a[m]  b[2*m], each contains m elements only.
 You need to merge those two arrays into second array b[2*m]
 3. construct a Binary tree from a given String, where every node has zero
 or two children.
 e.g String = NNNLLL  , N represents internal Node , L represents leaf
 Node.


 The alloted time was 1hr. and asked to write the function only ... no
 main function and all.
 hope this helps

 Thanks
 vinay

 On Wed, Feb 16, 2011 at 3:45 PM, Anurag Bhatia abhati...@gmail.comwrote:

 Has anyone give any first round online test for Amazon? If yes, can
 you please share details?

 --Anurag

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] Amazon Online Test

2011-02-23 Thread murthy.krishn...@gmail.com
hii vinay,

the prob is we can get many such trees given a preorder traversal with the
condition that each node has zero or two children. Please correct me if I am
wrong.

Thanks,
Krishna.

On Wed, Feb 23, 2011 at 6:00 PM, murthy.krishn...@gmail.com 
murthy.krishn...@gmail.com wrote:

 thanks vinay :-)


 On Wed, Feb 23, 2011 at 5:39 PM, vinay reddy gvina...@gmail.com wrote:

 U need to construct a binary tree given only PreOrder traversal with the
 condition that each node has zero or two children.

 On Wed, Feb 23, 2011 at 10:52 AM, murthy.krishn...@gmail.com 
 murthy.krishn...@gmail.com wrote:

 hii vinay,

 can u elaborate the third question

 thanks,
 Krishna

   On Wed, Feb 23, 2011 at 9:34 AM, vinay reddy gvina...@gmail.comwrote:

  Hi Anurag,

 I have taken that online test there were 3 questions ...
 1. given a linked list check if it is a palindrome.
 2.given two sorted arrays a[m]  b[2*m], each contains m elements only.
 You need to merge those two arrays into second array b[2*m]
 3. construct a Binary tree from a given String, where every node has
 zero or two children.
 e.g String = NNNLLL  , N represents internal Node , L represents leaf
 Node.


 The alloted time was 1hr. and asked to write the function only ... no
 main function and all.
 hope this helps

 Thanks
 vinay

 On Wed, Feb 16, 2011 at 3:45 PM, Anurag Bhatia abhati...@gmail.comwrote:

 Has anyone give any first round online test for Amazon? If yes, can
 you please share details?

 --Anurag

 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from 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] Amazon Online Test

2011-02-22 Thread murthy.krishn...@gmail.com
hii vinay,

can u elaborate the third question

thanks,
Krishna

On Wed, Feb 23, 2011 at 9:34 AM, vinay reddy gvina...@gmail.com wrote:

 Hi Anurag,

 I have taken that online test there were 3 questions ...
 1. given a linked list check if it is a palindrome.
 2.given two sorted arrays a[m]  b[2*m], each contains m elements only. You
 need to merge those two arrays into second array b[2*m]
 3. construct a Binary tree from a given String, where every node has zero
 or two children.
 e.g String = NNNLLL  , N represents internal Node , L represents leaf
 Node.


 The alloted time was 1hr. and asked to write the function only ... no main
 function and all.
 hope this helps

 Thanks
 vinay

 On Wed, Feb 16, 2011 at 3:45 PM, Anurag Bhatia abhati...@gmail.comwrote:

 Has anyone give any first round online test for Amazon? If yes, can
 you please share details?

 --Anurag

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