[algogeeks] Reverse a XOR linked list in O(1) time ?

2011-11-30 Thread Rajeev Kumar
-- 
Thank You
Rajeev Kumar

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



Re: [algogeeks] MICROSOFT

2011-09-05 Thread Rajeev Kumar
We can use linked HashMap
Refer :
http://download.oracle.com/javase/6/docs/api/java/util/LinkedHashMap.html

On Mon, Sep 5, 2011 at 1:42 PM, bharatkumar bagana 
bagana.bharatku...@gmail.com wrote:

 @Anup:
 how can u say that the hash function used is a%10 
 That is internal , not in the hands of user ..
 Usually while inserting a value in Hash Table , we don't give the size of
 the table ahead ... It decides some size, and implements.. when we cross the
 assumed size,then it again gives some more memory so that all the operations
 are optimum (less collisions).


 On Sun, Sep 4, 2011 at 5:32 PM, Anup Ghatage ghat...@gmail.com wrote:

 Sid,

 I'm afraid a hash table won't help much.

 Given the elements as follows: { 10,20,30,10,20,20,30,30,30,30,10 }

 All of them will be hashed into the 0'th cell for a % 10 hash function,
 and then probably the overflow will be handled by chaining.
 So that will be governed by m^2 in worst case.

 So the algorithm would be O( m^2 log m ) just to populate the hash and
 find the frequencies.

 --
  Anup Ghatage

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




 --

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


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




-- 
Thank You
Rajeev Kumar

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

2011-08-30 Thread Rajeev Kumar
use Babylonian method(Efficient) algrithm..
Refer :
http://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method


public *void* getSquareRoot(double s) {
  double Xn = 2.0;
  double lastXn = 0.0;
  while (Xn != lastXn) {
   lastXn = Xn;
   Xn = (Xn + s / Xn) / 2.0;
  }
  return Xn;
 }





On Tue, Aug 30, 2011 at 1:49 PM, Ankur Garg ankurga...@gmail.com wrote:

 @techcoder

 Making an array of 32768 or INT_MAX will make ur compiler cry

 Also ur case doesnt handle the scenario where square root is a decimal
 number



 On Tue, Aug 30, 2011 at 1:35 PM, tech coder techcoderonw...@gmail.comwrote:

 the sqrt of 32 bit number can't be more than 16 bits.

 have an array of 2^16 elemnts wtih elemts 1 2 3 4 5  32768 .

 now apply binary search
 i=a[mid]where mid=(lower+upper)/2

 if(i*i==num)
 i is the sqrt

 increment lower and upper accordingly as we do in binary search

 so order is Olognwhere n=2^16


 On Tue, Aug 30, 2011 at 11:37 AM, Raghavan its...@gmail.com wrote:

 how to design this logic effectively?

 double squareRoot(int num){

 }



 --
 Thanks and Regards,
 Raghavan KL

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




-- 
Thank You
Rajeev Kumar

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

2011-08-01 Thread Rajeev Kumar
go to this link and upload ur resume...they will call if they feel it is
good
http://www.india.amazon.com/Careers/

http://www.india.amazon.com/Careers/

On Mon, Aug 1, 2011 at 11:58 PM, coder dumca coder.du...@gmail.com wrote:

 hi frnds
 can any body tell me how a student can appear for amazon or microsoft , if
 these comanies are not coming to the campus.

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




-- 
Thank You
Rajeev Kumar

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

2011-07-29 Thread Rajeev Kumar
@All : pls suggest an algo.


On Fri, Jul 29, 2011 at 10:21 AM, sukhmeet singh sukhmeet2...@gmail.comwrote:

 *http://code.google.com/codejam/contest/dashboard?c=32001*


 On Fri, Jul 29, 2011 at 10:43 PM, swetha rahul swetharahu...@gmail.comwrote:

 Hi,
 given a complete binary tree (either a node is a leaf node or
 has two children)

 every leaf node has value 0 or 1.
 every internal node has value as the AND gate or OR gate.
 you are given with the tree and a value V.
 you have to output the minimum number of flips (AND to OR or OR to AND) if
 the evaluated value is not equal to V, if it is equal return 0, if not
 possible return -1.
 you can just change the value of internal nodes i.e can make and to or ,
 or to and to get the desired output
 give the minimum number of flips required to get the desired output.

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




-- 
Thank You
Rajeev Kumar

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

2011-07-28 Thread Rajeev Kumar
@Puneet,
 get_power(int a, int b) works in O(logb) as you keep on dividing b with
2...
you are calling that method *P *times in *func(int p) *method.
So it is *plogb...*u r passing 5 as b valueit will be *plog5*

On Thu, Jul 28, 2011 at 11:45 AM, Puneet Gautam puneet.nsi...@gmail.comwrote:

 @sachin: Explain pls...!!?


 On 7/28/11, sachin sharma sachin.bles...@gmail.com wrote:
  it is O(plg5)
 
 
  Best Wishes
  Sachin 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.
 
 

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




-- 
Thank You
Rajeev Kumar

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

2011-07-28 Thread Rajeev Kumar
@Tayler : That's y i am using Java ArrayList instead of linked list where
arrayList maintains element position.But problem is when an element is
removed from the list,all subsequent elements to be moved forward
Please check javadoc of arrayList :
http://download.oracle.com/javase/6/docs/api/java/util/ArrayList.html

On Thu, Jul 28, 2011 at 11:58 AM, Tyler Durden abhishek.khattr...@gmail.com
 wrote:

 @Rajeev:
 How will you update the position of each element in the linked list after
 removing a particular element? Won't you have to traverse the list
 completely in which case your algo will be O(n^2) ??

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

 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Thank You
Rajeev Kumar

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

2011-07-28 Thread Rajeev Kumar
@puneet

Can you give us an example what u mean by 180 degree rotation...
For given matrix like
1, 2,   3, 4
5, 6,   7, 8
9,10,11,  12
13,14,15,16

What is the expected output?

On Wed, Jul 27, 2011 at 11:29 PM, Puneet Gautam puneet.nsi...@gmail.comwrote:

 Can anyone give an O(n) solution pls...??
 I think the above code is an O(n^2) solution..
 if i am not wrong...!!!



 On 7/27/11, amit amit.codenam...@gmail.com wrote:
  #include cstdio
  #include algorithm
  using namespace std;
 
  const int MX = 1000;
  int n, m;
  int a[MX][MX];
 
  int main() {
  scanf(%d%d, n, m);
  for(int i = 0; i  n; i++)
  for(int j = 0; j  m; j++)
  scanf(%d, a[i][j]);
 
  for(int i = 0; i  n/2; i++)
  for(int j = 0; j  m; j++)
  swap(a[i][j], a[n-i-1][m-j-1]);
  if(n1)
  for(int j = 0; j  m/2; j++)
  swap(a[n/2][j], a[n/2][m-j-1]);
 
  for(int i = 0; i  n; i++) {
  for(int j = 0; j  m; j++)
  printf(%d , a[i][j]);
  printf(\n);
  }
  }
 
 
  On Jul 27, 7:54 pm, Anika Jain anika.jai...@gmail.com wrote:
  is it lyk for {1,2,3
 4,5,6,
 7,8,9}
  to be {3,2,1,
   6,5,4,
   9,8,7}??
 
 
 
  On Wed, Jul 27, 2011 at 9:37 AM, Deoki Nandan deok...@gmail.com
 wrote:
   rotate a 2D matrix by angle 180
 
   --
   **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.
 
 

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




-- 
Thank You
Rajeev Kumar

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

2011-07-28 Thread Rajeev Kumar
 AND ENGINEERING
 NIT ALLAHABAD

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




-- 
Thank You
Rajeev Kumar

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

2011-07-28 Thread Rajeev Kumar
@Tushar :
We can do it...thing is to modify the getCombinations() method in the
program to select any two instead of selecting two elements side by
side...

On Thu, Jul 28, 2011 at 7:31 AM, Tushar Bindal tushicom...@gmail.comwrote:

 yeah
 i was just confirming that it is meant to be printed or is it considered
 reduntant as it wasn't mentioned in the question.

 thanks for this algo.

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




-- 
Thank You
Rajeev Kumar

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

2011-07-28 Thread Rajeev Kumar
http://www.solipsys.co.uk/new/EveryLanguageFixesSomething.html?HN0

-- 
Thank You
Rajeev Kumar

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

2011-07-28 Thread Rajeev Kumar
http://www.readwriteweb.com/hack/2011/07/the-history-of-programming-languages-infographic.php

On Thu, Jul 28, 2011 at 7:42 PM, Rajeev Kumar rajeevprasa...@gmail.comwrote:

 http://www.solipsys.co.uk/new/EveryLanguageFixesSomething.html?HN0

 --
 Thank You
 Rajeev Kumar




-- 
Thank You
Rajeev Kumar

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

2011-07-28 Thread Rajeev Kumar
@Aman : check this(same as ankit said) :
http://tech-queries.blogspot.com/2009/05/max-possible-sum-of-non-consecutive.html

On Fri, Jul 29, 2011 at 9:59 AM, ankit sambyal ankitsamb...@gmail.comwrote:

 1. Make an array S equal to the length of the given array where
 S[0] = a[0] and S[1] = max(a[0],a[1])

 2. for i:2 to n-1

  S[i] = max(S[i-2]+a[i], S[i-1])

 3. return S[n-1]

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




-- 
Thank You
Rajeev Kumar

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

2011-07-27 Thread Rajeev Kumar
Hey ankit, i gave java code also...didn't u check it in the link...anyway i
am explaining here.

*Note : Position count starts from 0. *
*ex: {1,2,3,4} ...position of '1' is zero*
*
*
*In the below approach,we are checking element position in the modified
list(after deletion operation in the previous iteration).*

given array is : ar[]= {1,3,2,4,5,4,2}.
construct a list with array elements and sort it.Now list contains
:1,2,2,3,4,4,5

Now traverse through array elements from i=0 to n-1(start to end)
store result in result[] array.

list is *1*-2-2-3-4-4-5
for i=0, a[0]=1,search for a[0] position in the list(right
occurrence).a[0]=1 position in list is '0'
add '0' to result.===result[0]=0;
remove the element a[0] from the list.now list contains 2-2-*3*-4-4-5

for i=1,a[1]=3,search for a[1] position in the list(right occurence).a[1]=3
position in list is '2'
  add '2' to resultresult[1]=2
remove the element a[1] from the list.now list contains 2-*2*-4-4-5


for i=2,a[2]=2,search for a[2] position in the list(right occurence).a[2]=2
position in list is '1'
  add '1' to resultresult[2]=1
remove the element a[2] from the list.now list contains 2-4-*4*-5


for i=3,a[3]=4,search for a[3] position in the list(right occurence).a[3]=4
position in list is '2'
  add '2' to resultresult[3]=2
remove the element a[3] from the list.now list contains 2-4-5


for i=4,a[4]=5,search for a[4] position in the list(right occurence).a[4]=5
position in list is '2'
  add '2' to resultresult[4]=2
remove the element a[4] from the list.now list contains 2-*4*


for i=5,a[5]=4,search for a[5] position in the list(right occurence).a[5]=4
position in list is '1'
  add '1' to resultresult[5]=1
remove the element a[5] from the list.now list contains 2


for i=6,a[6]=2,search for a[6] position in the list(right occurence).a[6]=2
position in list is '0'
  add '0' to resultresult[6]=0
remove the element a[6] from the list.now list is empty.


resultant array contains :
from all conditions :
add '0' to result.===result[0]=0;
add '2' to resultresult[1]=2
add '1' to resultresult[2]=1
add '1' to resultresult[3]=2
add '2' to resultresult[4]=2
add '1' to resultresult[5]=1
add '0' to resultresult[6]=0

expected result   {0,2,1,2,2,1,0}
actual result =={0,2,1,2,2,1,0}


I hope u r clear now.Please let me know if you still have
doubts...

U can execute the java code given in link :
http://rajeevprasanna.blogspot.com/2011/07/count-number-of-min-elements-on-right.html

I will be more happy if you give me failed cases...



On Wed, Jul 27, 2011 at 11:25 AM, ankit sambyal ankitsamb...@gmail.comwrote:

 @rajeev :try the example given in the question. And explain ur algo with
 that example




-- 
Thank You
Rajeev Kumar

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

2011-07-27 Thread Rajeev Kumar
One more thread is running parallel on the same topic
Please refer :
http://comments.gmane.org/gmane.comp.programming.algogeeks/17279


On Wed, Jul 27, 2011 at 7:39 AM, Nikhil Gupta nikhilgupta2...@gmail.comwrote:

 Given a string of length 5 (example abcde), write a program to print all
 the possible combinations OF LENGTH 3.

 In this case : abc, abd, abe, acd, ace, ade, bcd, bce, bde, cde

 Can someone provide a working code?

 --
 Nikhil Gupta
 Senior Co-ordinator, Publicity
 CSI, NSIT Students' Branch
 NSIT, New Delhi, India

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




-- 
Thank You
Rajeev Kumar

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

2011-07-27 Thread Rajeev Kumar
@$iva : check this link :
http://www.technicalypto.com/search/label/binary%20tree

On Wed, Jul 27, 2011 at 11:08 AM, sivaviknesh s sivavikne...@gmail.comwrote:

 How to find Least Common Ancestor of a BINARY TREE without using PARENT
 POINTERS ?

 give algo / ideas plz ??

 --
 Regards,
 $iva

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




-- 
Thank You
Rajeev Kumar

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

2011-07-26 Thread Rajeev Kumar
check this link and let me know if anything wrong:
http://rajeevprasanna.blogspot.com/2011/07/is-given-characters-of-string-form.html


On Tue, Jul 26, 2011 at 11:37 AM, Anika Jain anika.jai...@gmail.com wrote:

 int palin(char *p)
 {
 int x=0;
 while(*p)
 {
 x^=1(*p-'a');
 p++;
 }
 int i=0,count=0;
 while(i26)
 {
 count+=(1i  x)i;
 i++;
 }
 if(count1)
 return 0;
 else

 return 1;
 }

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




-- 
Thank You
Rajeev Kumar

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

2011-07-26 Thread Rajeev Kumar
*
Algorithm :
1)Conside original array a[]
2)Construct a sorted list with the array elements(O(nlogn))
3)Traverse across all elements of the original array 'a' and find it's
position(right occurence) in the sorted list using binary search.
  -position in the sorted list returns the number of elements in the less
than the current element on right side.
  -after remove the current element from the sorted list.
PS: list is preferred datastructure because there are so many insertion and
deletion operations.

check this link :
http://rajeevprasanna.blogspot.com/2011/07/count-number-of-min-elements-on-right.html
*
On Tue, Jul 26, 2011 at 11:08 AM, ankit sambyal ankitsamb...@gmail.comwrote:

 @vivin : Your algo seems to be  wrong. Plz take an example and
 explain. I may hv misunderstood u ..

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




-- 
Thank You
Rajeev Kumar

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

2011-07-26 Thread Rajeev Kumar
@ankit : can u give me a case where it fails...

On Wed, Jul 27, 2011 at 8:33 AM, ankit sambyal ankitsamb...@gmail.comwrote:

 @rajeev:ur algo does not give the correct answer.

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




-- 
Thank You
Rajeev Kumar

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

2011-07-26 Thread Rajeev Kumar
@ankit : can u give me a case where it fails...

On Wed, Jul 27, 2011 at 8:33 AM, ankit sambyal ankitsamb...@gmail.comwrote:

 @rajeev:ur algo does not give the correct answer.

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




-- 
Thank You
Rajeev Kumar

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

2011-07-25 Thread Rajeev Kumar
Hi friends,
 Go through this link.U may find it helpful...
  http://blogs.oracle.com/sandip/entry/how_to_be_a_good


-- 
Thank You
Rajeev Kumar

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

2011-07-24 Thread Rajeev Kumar
In java,Hash table is synchronized where as hash map is non
synchronized.

On Sat, Jul 23, 2011 at 11:33 PM, rajeev bharshetty rajeevr...@gmail.comwrote:

 Hash Table and hash map are same .
 For insertion might take O(1) time if a good hash function is used . and
 searching also O(1) considering no collisions.



 On Sun, Jul 24, 2011 abt 11:31 AM, sivaviknesh s 
 sivavikne...@gmail.comwrote:

 what is the time complexity of a hash map??for insertion and searching

 are hash table and hash map same ??

 can anybody give a good explanation with example or even suggest good
 links.thanks in advance :)



 --
 Regards,
 $iva

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




 --
 Regards
 Rajeev N B http://www.opensourcemania.co.cc

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




-- 
Thank You
Rajeev Kumar

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

2011-07-22 Thread Rajeev Kumar
Please check this : http://www.techinterview.org/post/526313890/bad-king

On Tue, Jul 19, 2011 at 8:43 PM, sagar pareek sagarpar...@gmail.com wrote:

 hey guys pls tell any other better solution ...


 On Tue, Jul 19, 2011 at 6:41 PM, sagar pareek sagarpar...@gmail.comwrote:

 Question :-



 Once upon a time in ancient times there was a king who was very fond of
 wines.  He had a huge cellar, which had 1000 different varieties of wine
 all in different caskets (1000 caskets in all).  In the adjoining kingdom
 there was a queen who was envious of the king’s huge wine collection.  After
 some time when she could not bear it any more she conspired to kill her by
 poisoning all his wine caskets.  So she one sentry to poison all the
 caskets, but no sooner had the sentry poisoned only one wine casket that he
 was caught and killed by the Royal guards.  Now the king had a major
 problem in his hand so as to identify the right casket, which he gave to the
 Minister.  Now the position had two peculiar qualities



  Anyone who takes even one drop of poison will die.

  But, he will die only after one month.



  The king also gave the Minister 10 prisoners who could be used
 as tasters, cause there lives was of no consequence to the king of kingdom
 for that matter, and the Minister was given one month to find the poisoned
 casket.  Is it possible for the Minister to find out in one month?  If so
 how? If not then how many months are required?





 My solution :-

 This can be done in one month

 Think the solution in binary

 ok first i wanna ask u a question :- how many bits are needed to represent
 the number 1000 ?
 yeah u r right - 10 bits

 so here is the solution
 let if any prisoner alive it mean it doesnt die and it will be represented
 by 1 else if he dies then he will be represented by 0
 number the prisoners from 0-9 with 0 the right most (LSB)
 now what will be binary representation of 0 ? 00
 so if 0th bottle is poisoned then all prisoners must die so taste the
 0th(actually 1st) wine to all the prisoners.
 what is binary representation of 1? 01
 so taste the 1st(actually 2nd) wine to all except the 0th prisoner.
 for 2nd, all except 1st (considering 0th as lowest bit) one

 and so on.
 so at the end if suppose 6th and 2nd prisoner(consider 0 min and 9 max)
 left alive then answer will be :- 1*2^5+1*2^1 +1  (note:- here ^= power)


 if anyone have more general solution pls let me know

 *I hope this is useful  :) :)*



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




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

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




-- 
Thank You
Rajeev Kumar

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

2011-07-22 Thread Rajeev Kumar
Please check this program in java and add your comments if you feel anything
wrong
http://rajeevprasanna.blogspot.com/2011/07/add-two-numbers-stored-in-linked-lists.html

2011/7/18 η!Ƭ!گђ nitish.ii...@gmail.com

 #include stdio.h
 #include stdlib.h
 #include malloc.h

 struct node
 {
 char ch;
  struct node *ptr;
 }*tp,*sp;

 int c = 0;
 int insert(struct node *list)
 {
 int n,num,hd;
  scanf(%d,n);
 hd = n;
 struct node *temp;
  n--;
 while(n--)
 {
 scanf(%d,num);
  list-ch = num;
 temp = (struct node *)malloc(sizeof(struct node));
 list-ptr = temp;
  list = list-ptr;
 }
 scanf(%d,num);
  list-ch = num;
 return hd;
 }

 void add(struct node *list1,struct node *list2)
 {
 if((list1  list1-ptr)  (list2  list2-ptr))
 add(list1-ptr,list2-ptr);
  struct node *temp;
 temp = (struct node *)malloc(sizeof(struct node));
 if((c + (list1-ch + list2-ch)) = 10){
  tp-ch = (c + (list1-ch+list2-ch)) -10;
 c = 1;
 tp -ptr = temp;
  tp = tp-ptr;
 }
 else{
  tp-ch = (c + list1-ch + list2-ch);
 c = 0;
 tp-ptr = temp;
  tp = tp-ptr;
 }
 }

 void print(struct node *list)
 {
 if(list-ptr)
 {
 print(list-ptr);
  printf(%d ,list-ch);
 }
 else if(list-ch)
  printf(%d ,list-ch);
 }

 int main()
 {
 int pos1,pos2,x;
  struct node *list1,*list2,*temp;
 list1 = (struct node *)malloc(sizeof(struct node));
  list2 = (struct node *)malloc(sizeof(struct node));
 temp = (struct node *)malloc (sizeof(struct node));
  sp = (struct node *)malloc(sizeof(struct node));
 sp = temp;
 pos1 = insert(list1);
  pos2 = insert(list2);
 if(pos1pos2)
 x = pos1-pos2-1;
  else
 x = pos2-pos1-1;

 while((x--)  0){
  temp-ch = 0;
 tp = (struct node *)malloc(sizeof(struct node));
 temp-ptr = tp;
  temp = temp-ptr;
 }
 if(pos2  pos1){
  temp-ch = 0;
 temp-ptr = list1;
 list1 = sp;
  }
 else if(pos1  pos2){
 temp-ch =0;
  temp-ptr = list2;
 list2 = sp;
 }
  tp = (struct node *)malloc(sizeof(struct node));
 sp = tp;
 add(list1,list2);
  tp-ch = c;
 print(sp);
 printf(\n);
  return 0;
 }


 On Tue, Jul 19, 2011 at 1:10 AM, SkRiPt KiDdIe anuragmsi...@gmail.comwrote:

 #includecstdlib
 #includeiostream
 using namespace std;

 struct node{
 int val;
 node *next;
 };

 node * Input(int n)
 {
 node *temp,*list,*end;

 int x;
 for(int i=0;in;i++)
 {
 cinx;

 temp=(node*)malloc(sizeof(node));temp-val=x;temp-next=NULL;

 if(!i)list=end=temp;
 else end=end-next=temp;
 }
 return list;
 }
 void Rev(node *head,node *add)
 {
 if(!head){head=add;return;}
 node *t=head;head=head-next;
 Rev(head,t);
 t-next=add;
 }
 void Show(node *head)
 {
 while(head){couthead-val ;head=head-next;}
 cout\n\n;
 }
 node * Add(node* a, node *b,node *c,int carry)
 {
 node *temp;

 if(!a)
 {
 while(carry)
 {
 temp=(node*)malloc(sizeof(node));
 temp-val=carry%10;temp-next=NULL;
 carry/=10;
 c=c-next=temp;
 }return c;
 }

 temp=(node*)malloc(sizeof(node));
 temp-val=(a-val+b-val+carry)%10;

 if(!c)c=temp;
 else c=c-next=temp;

 Add(a-next,b-next,c,(a-val+b-val+carry)/10);
 return c;
 }
 int main()
 {

 node *list1,*list2,*list3=NULL,*temp;

 int n1,n2;

 cinn1;
 list1=Input(n1);//Input list 1
 cinn2;
 list2=Input(n2);//Input list 2


 if(n2n1)while((n2--)-n1){temp=(node*)malloc(sizeof(node));temp-val=0;temp-next=list1;list1=temp;}
 else
 while((n1--)-n2){temp=(node*)malloc(sizeof(node));temp-val=0;temp-next=list2;list2=temp;}


 Rev(list1,NULL);
 Rev(list2,NULL);
 list3=Add(list1,list2,list3,0);
 Rev(list3,NULL);
 Show(list3);
 return 0;
 }

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




-- 
Thank You
Rajeev Kumar

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

2011-07-22 Thread Rajeev Kumar
check
http://tech-queries.blogspot.com/2009/05/max-possible-sum-of-non-consecutive.html

On Wed, Jul 20, 2011 at 11:58 PM, sunny agrawal sunny816.i...@gmail.comwrote:

 Just take an extra array that will keep track of the values from which we
 get the best in solution to that thread.



 On Thu, Jul 21, 2011 at 8:55 AM, UMESH KUMAR kumar.umesh...@gmail.comwrote:

 Hi
 @Somnath my question is some different

 if given array :3,2,7,10
 So according to last discussion Only Out put is *13 *not the show
 elements
 Output :: {3,10}

 So basically my question is that how to pick all elements that return max
 sum

 Thanks..

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




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




-- 
Thank You
Rajeev Kumar

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

2011-07-21 Thread Rajeev Kumar
Check : http://ihaventyetdecided.blogspot.com/2010/10/josephus-problem.html

On Thu, Jul 21, 2011 at 6:51 AM, Aman Goyal aman.goya...@gmail.com wrote:

 they start shooting the person standing next to their neighbour


 On Thu, Jul 21, 2011 at 4:38 PM, Vivek Srivastava 
 srivastava.vivek1...@gmail.com wrote:

 No,That is not the sequence?As I said 'I' will kill '3' as 3 is next to
 i's neighbour.

 On Thu, Jul 21, 2011 at 4:16 PM, SAMMM somnath.nit...@gmail.com wrote:

 Consider this Example:-



  1 2 3 4 5 6 7 1 In CIrcle 

  1 kills 2
  3 kills 4
  5 kills 6
  7 kills 1

 Remaining ppl :- 3 5 7

 3 kills 5
 7 kills 3

 Remain- 7


 This  is the sequence .. i guess   Isit

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




-- 
Thank You
Rajeev Kumar

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Minimum/Maximum Sum path in A Binary Tree

2011-07-12 Thread Rajeev Kumar
I want to find the maximum or minimum sum path in binary tree(*not BST*)?
any one have idea?

-- 
Thank You
Rajeev Kumar

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] remove duplicate chars in a string without using extra memory

2011-05-28 Thread Rajeev Kumar
Design an algorithm and write code to remove the duplicate characters in a
string without using any additional buffer.
 NOTE: One or two additional variables are fine.
 An extra copy of the array is not.


-- 
Thank You
Rajeev Kumar

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

2011-04-11 Thread Rajeev Kumar
@Praveen
*
*
*  Don't worry abt these.Just report spam in gmail.Google will take care of
him.If every one reported spam,he will be blocked*

On Mon, Apr 11, 2011 at 3:15 PM, Praveen Kumar praveen97...@gmail.comwrote:

 Will the group owner or manager or moderator please ban this sexy bitch?


 On Mon, Apr 11, 2011 at 3:03 PM, SUNITHA BUSETTY 
 sunitha.buse...@gmail.com wrote:

   hot lipkiss
 http://hotactressstoyou.blogspot.com/2011/04/lipkiss-2.html
   lipkiss in without dress
 http://hotactressstoyou.blogspot.com/2011/04/lipkiss.html
seepika padukone sexy back look
 http://hotactressstoyou.blogspot.com/2011/04/deepika-padukone.html
   sexy katrina kaif
 http://hotactressstoyou.blogspot.com/2011/04/katrina-kaif.html
beauty keerthi chawla
 http://hotactressstoyou.blogspot.com/2011/04/keerthi-chawla.html
   saloni sexy photos
 http://hotactressstoyou.blogspot.com/2011/04/saloni.html
 deeksha seth in a hot saree
 http://hotactressstoyou.blogspot.com/2011/04/deeksha-seth.html
 asin hot wallpapers
 http://hotactressstoyou.blogspot.com/2011/04/asin.html
ramba in a red dress
 http://hotactressstoyou.blogspot.com/2011/04/ramba.html
  sexy ilieana is in scert
 http://hotactressstoyou.blogspot.com/2011/04/ileana.html


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




-- 
Thank You
Rajeev Kumar

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Find kth largest sum of elements from two arrays

2011-04-01 Thread Rajeev Kumar
Two sorted arrays A and B have been given.such that size of A is m and size
of B is n
You need to find the k th largest sum (a+b) where a is taken from A and b is
taken from B. such that k  m*n



-- 
Thank You
Rajeev Kumar

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

2011-03-27 Thread Rajeev Kumar
see this : http://denenberg.com/omf.pdf

On Sun, Mar 27, 2011 at 6:40 AM, bittu shashank7andr...@gmail.com wrote:

 Numbers are randomly generated and passed to a method. Write a program
 to find and maintain the median value as new values are generated.



 Thanks
 Shashank

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




-- 
Thank You
Rajeev Kumar

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

2011-03-24 Thread Rajeev Kumar
get A's friends into array a[]
get B's friend into array b[]

use algo to find if they have at least one common element.
Assume A is in the friends list of A(in array a[])  and B is in the friends
list of B(in array b[]).

If they have common element(friend) show else don't show.




On Thu, Mar 24, 2011 at 6:39 PM, ligerdave david.c...@gmail.com wrote:

 Instead of looking for a common friend of A and B, look for someone
 who has friends A and B.

 if you are using relational DB, use count()


 didn't quite understand your first part that only if A is friend of
 B. i assume when A is a friend of B, B is a friend of A as well

 On Mar 24, 6:43 am, snehal jain learner@gmail.com wrote:
  Suppose there are 2 persons A and B on FB . A should be able to view
  the pictures of B only if either A is friend of B or A and B have at
  least one common friend .

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




-- 
Thank You
Rajeev Kumar

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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] Application of OOD(Object Oriented Design) System Design -Design Clock Room..??

2011-03-24 Thread Rajeev Kumar
Can you provide more details

On Thu, Mar 24, 2011 at 11:53 AM, bittu shashank7andr...@gmail.com wrote:

 Design a system to manage clock room ( used at railway station). Like
 what data structure, how ? U need to give O(1) time solution + small
 space complexity.


 Thanks
 Shashank Mani



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




-- 
Thank You
Rajeev Kumar

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

2011-03-22 Thread Rajeev Kumar
http://math.ucsd.edu/~wgarner/personal/puzzles/cube_puzzle_sol.htm

On Tue, Mar 1, 2011 at 8:46 AM, Vinay Pandey babbupan...@gmail.com wrote:

 each pair of opposite faces can make 4 such triangles, so I think the
 answer is 12


 On Mon, Feb 28, 2011 at 5:47 AM, sourabh jakhar 
 sourabhjak...@gmail.comwrote:

 the answer would be more than 8 an it is 32 i think.
 but i m sure it will be more than 8


 On Wed, Feb 23, 2011 at 7:54 AM, Terence technic@gmail.com wrote:

  8C3 - 12 * 4C3 = 8
 Any 3 vertices out of a rectangle only form a right triangles.
 Then only 8 regular triangle left. (Cut out each of the 8 vertices)


 On 2011-2-23 3:10, jalaj jaiswal wrote:

 answer is 8 ,,, duno how

 On Wed, Feb 23, 2011 at 12:31 AM, Sundi sundi...@gmail.com wrote:

 Is it not 8C3 = 56



 On Feb 22, 9:55 pm, jalaj jaiswal jalaj.jaiswa...@gmail.com wrote:
  Think of the 8 vertices of a given cube. You are allowed to join three
  vertices to form a triangle. How many such unique acute triangles can
 you
  make ??
 
  --
  With Regards,
  *Jalaj Jaiswal* (+919019947895)
  Software developer, Cisco Systems
  B.Tech IIIT 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.




 --
 With Regards,
 *Jalaj Jaiswal* (+919019947895)
 Software developer, Cisco Systems
 B.Tech IIIT ALLAHABAD

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

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




 --
 SOURABH JAKHAR,(CSE)(3 year)
 ROOM NO 167 ,
 TILAK,HOSTEL
 'MNNIT ALLAHABAD

 The Law of Win says, Let's not do it your way or my way; let's do it the
 best way.

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




-- 
Thank You
Rajeev Kumar

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from 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: Find the first K smallest element from 1 million sized array ...Amazon Question..

2011-03-21 Thread Rajeev Kumar
http://flexaired.blogspot.com/2011/03/big-file-containing-billions-of-numbers.html

On Mon, Mar 21, 2011 at 4:05 AM, Natansh Verma natansh.ve...@gmail.comwrote:

 @dave -was this a constraint since the beginning? In case it was, I am
 sorry I didn't notice.

 In that case, the heap method ought to work better. I dont think the
 quicksort method will work.

 Sent from my iPhone

 On 20-Mar-2011, at 23:00, Dave dave_and_da...@juno.com wrote:

  @Natansh: How do you do this with the constraint that your RAM is so
  small that you cannot accomodate all of the numbers at once?
 
  Dave
 
  On Mar 20, 9:04 am, Natansh Verma natansh.ve...@gmail.com wrote:
  There's another way... use the partitioning method for quicksort to find
 the
  k smallest elements. Then it should take expected time as O(n + klogk).
  Plus, it is in-place.
 
 
 
  On Wed, Mar 16, 2011 at 7:26 PM, asit lipu...@gmail.com wrote:
  I agree with munna
 
  --
  You received this message because you are subscribed to the Google
 Groups
  Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from this group, send email to
  algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.- Hide quoted text -
 
  - Show quoted text -
 
  --
  You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
  To post to this group, send email to algogeeks@googlegroups.com.
  To unsubscribe from 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.




-- 
Thank You
Rajeev Kumar

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

2011-02-08 Thread Rajeev Kumar
u can find more explanation here:
http://www.techinterview.org/post/526370758/100-doors-in-a-row

On Tue, Feb 8, 2011 at 12:52 PM, sunny agrawal sunny816.i...@gmail.comwrote:

 finally all square number gates will be open


 On Wed, Feb 9, 2011 at 2:10 AM, bittu shashank7andr...@gmail.com wrote:

 There are N doors in a row numbered from 1 to N. Initially all are
 closed.
 Then you make N passes by the N doors. In pass 1 you toggle the all
 the doors (1,2,3,4)starting from the first door. In the second
 pass you toggle every second door(2,4,6,8,...). In the third pass you
 toggle all third doors(3,6,9...).Similarly you make N passes.

 Question is what is the state of door k after N passes.

 Thanks  Regards
 Shashank 

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




-- 
Thank You
Rajeev Kumar

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

2011-02-07 Thread Rajeev Kumar
Any solution for this

On Fri, Jan 21, 2011 at 1:56 PM, Gaurav_K_Singh gaurav.bhu1...@gmail.comwrote:

 *

 Place N number from 1 to N, in 2N positions in such a way so that there
 are

 Exactly “a” number of cells between two placed locations of number “a”.
 Write a program to display numbers placed in this way.



 Example:-

 (1) One of the possible placement for 7 numbers in 14 positions is :

 5 7 2 3 6 2 5 3 4 7 1 6 1 4

 There are exactly five other numbers between two occurrences of 5, exactly
 seven other numbers between two occurrences of number 7 and the same is
 true for all other number placements.
 *
 --
 Only G!!

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




-- 
Thank You
Rajeev Kumar

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

2011-02-06 Thread Rajeev Kumar
certainly it is not n+1.
for n=1, ans is 'a'.No other word can be formed.

On Sun, Feb 6, 2011 at 7:10 PM, nphard nphard nphard.nph...@gmail.comwrote:

 For len = 6, isn't bcbcbc also valid?


 On Sun, Feb 6, 2011 at 9:08 PM, Anand anandut2...@gmail.com wrote:

 There is a language with only two elements ie 'a' and 'bc'. How many words
 can be
 made out of it if whose Length is n.

 I think it is n+1.


 if the len = 3
 abc
 bca


 if the len is 6
 bc
 aaabca
 aabcaa
 abcaaa
 ba


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




-- 
Thank You
Rajeev Kumar

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

2011-01-27 Thread Rajeev Kumar
Hi,
 Can any one please suggest any good site to find good projects to do in
final year.

Thanks,
Rajeev.

On Fri, Jan 28, 2011 at 9:10 AM, Venu sendmail2v...@gmail.com wrote:

 Hi friends-

 This is Venu, studying final year B.Tech in Computer Science at
 Jawaharlal Nehru University, Hyderabad.
 Can you please suggest me some ideas regarding my final year project
 (3 months duration).

 Thanking you in advance...

 Regards
 Venu.

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




-- 
Thank You
Rajeev Kumar

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

2011-01-18 Thread rajeev kumar
try http://www.careercup.com/

http://www.careercup.com/Thanks,
rajiv.

On Tue, Jan 18, 2011 at 7:57 AM, Yellow Sapphire pukhraj7...@gmail.comwrote:

 Hi,

 Can someone suggest good books/websites/blogs for interview related
 questions.


 thanks--
 YS

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




-- 
Thank You
Rajeev Kumar

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

2010-12-31 Thread rajeev kumar
Can any one tell me how to add two numbers using bitwise operators only.

After spending so much time on googling,i found the below java code.But is
is confusing.
algogeeks@googlegroups.compublic class AddTwoNumbers {

private static int myAdd(int a, int b)
{
int carry = a  b;
int result = a ^ b;
while(carry != 0)
{
int shiftedcarry = carry  1;
carry = result  shiftedcarry;
result ^= shiftedcarry;
}
return result;
}

public static void main(String[] args){
 System.out.println(myAdd(4, 5));
}

}


Please explain it.

-- 
Thank You
Rajeev Kumar

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from 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: add two numbers using bitwise operators

2010-12-31 Thread rajeev kumar
Thanks to every for kind response

On Fri, Dec 31, 2010 at 6:38 AM, Dave dave_and_da...@juno.com wrote:

 @Rajeev: When you add two one-bit quantities, you get a two-bit
 result:
 0 + 0 = 00, 0 + 1 = 01, 1 + 0 = 01, and 1 + 1 = 10.
 Note that the leftmost bit of sum of the the single-bit quantities A
 and B, obeys the logic A  B, and the rightmost bit obeys A ^ B, where
  is the logical AND operation and ^ is the logical eXclusive OR
 operation. When adding a multibit binary number, the leftmost bit
 carries into the next bit position. So the code you presented just
 does the multibit addition using the above two rules on all bits in
 parallel. The first two statements determine the results using the
 leftmost bit and rightmost bit rules above. If there are any
 carries, then they must be added to the next position to the left.
 Thus, shift the carries left one bit and repeat the addition process
 using the leftmost and rightmost bit rules again. Do this until there
 are no remaining carries. Hope this helps.

 Dave

 On Dec 31, 6:19 am, rajeev kumar rajeevprasa...@gmail.com wrote:
  Can any one tell me how to add two numbers using bitwise operators only.
 
  After spending so much time on googling,i found the below java code.But
 is
  is confusing.
  algogeeks@googlegroups.compublic class AddTwoNumbers {
 
  private static int myAdd(int a, int b)
  {
  int carry = a  b;
  int result = a ^ b;
  while(carry != 0)
  {
  int shiftedcarry = carry  1;
  carry = result  shiftedcarry;
  result ^= shiftedcarry;
  }
  return result;
  }
 
  public static void main(String[] args){
   System.out.println(myAdd(4, 5));
  }
 
  }
 
  Please explain it.
 
  --
  Thank You
  Rajeev Kumar

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




-- 
Thank You
Rajeev Kumar

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

2010-12-29 Thread rajeev kumar
you are given a string.It may have repeated characters.each character has
it's own weight.find combination of characters whose sum value is equal to
given value.

ex: given string 'abcbacbabcc'
weight of each character a-5,b-4,c-6.

character combination which gives sum 15 is 'aaa'

-- 
Thank You

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

2010-12-29 Thread rajeev kumar
String gives no of occurrences of each character.no of times you select a
character should be less than the no of times it appears in the string.


ex: given string 'abcbacbabcc' has 3 a's, 4b's, 4 c's.
resulting string should have a less than 3 times,b less than 4 times and c
less than 4 times.

On Wed, Dec 29, 2010 at 4:25 PM, vishal raja vishal.ge...@gmail.com wrote:

 What's the relation with the given string.
 I could'nt get you completely.

 On Wed, Dec 29, 2010 at 4:18 PM, suhash suhash.venkat...@gmail.comwrote:

 Is'nt this just a knapsack problem!

 On Dec 29, 3:45 pm, rajeev kumar rajeevprasa...@gmail.com wrote:
  you are given a string.It may have repeated characters.each character
 has
  it's own weight.find combination of characters whose sum value is equal
 to
  given value.
 
  ex: given string 'abcbacbabcc'
  weight of each character a-5,b-4,c-6.
 
  character combination which gives sum 15 is 'aaa'
 
  --
  Thank You

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Thank You
Rajeev Kumar

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

2010-12-29 Thread rajeev kumar
@juver++

can you elaborate this sentence 'It's a knapsack problem with bounds. Solve
it using DP' or send me any link which has good explanation.

On Wed, Dec 29, 2010 at 4:52 PM, vishal raja vishal.ge...@gmail.com wrote:

 i think we don't need to store the total no. of occurance of any character.
 we can think of it as a classic knapSack, We have n ( size of the string)
 items,  does'nt matter if they repeat or not . We don't have to keep a track
 how many of a char we have used as we have only options in this array , just
 take every index item as different item, that will automatcally do this.



 On Wed, Dec 29, 2010 at 4:46 PM, juver++ avpostni...@gmail.com wrote:

 It's a knapsack problem with bounds. Solve it using DP - for each state
 keep number of used characters and preserve to exceed the bounds.

 --
  You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@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 algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Thank You
Rajeev Kumar

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