Re: [algogeeks] Re: Finding the repeated element

2012-07-19 Thread Saurabh Yadav
@deepikaanand

(checksum   1 100) will it work ?

as i know int has only 32 bits !!



Thanks  Regards
Saurabh Yadav

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

2012-06-13 Thread Saurabh Yadav
+1 Ashish solution



-- 
Thanks  Regards
Saurabh Yadav

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

2012-06-13 Thread Saurabh Yadav
@shiv relate the ashish solution with quick sort then you will understand
easily

On Thu, Jun 14, 2012 at 2:06 AM, Saurabh Yadav saurabh...@gmail.com wrote:

 +1 Ashish solution



 --
 Thanks  Regards
 Saurabh Yadav




-- 
Thanks  Regards
Saurabh Yadav

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

2012-06-10 Thread Saurabh Yadav
question is incomplete , mention the conditions please

On Sun, Jun 10, 2012 at 11:44 AM, HARSHIT PAHUJA hpahuja.mn...@gmail.comwrote:





 There are 10 coins in a bag.

 3 coin weights x kg

 3 coins weights y kg

 2 coins weights z kg

 2 coins weights w kg

 You have to separate them into separate heaps according to their weights.



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




-- 
Thanks  Regards
Saurabh Yadav

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

2012-06-08 Thread Saurabh Yadav
order of hashing and counting is important
eg. abba
if we do hashing by characters 'a' is stored before 'b'
and count of both is 2 at the end and when we process this we give result
'a' (because 'a' comes before 'b' )which is wrong
because 'b' is the first repeated character.


Thanks  Regards
Saurabh

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



Re: [algogeeks] first Repeating character in a string

2012-06-08 Thread Saurabh Yadav
i was explaining the general idea which we generally use with hashing i.e.
hashing and counting the all the char and then find which is the repeated
character
yes u r correct , for the correct solution we should return when we found
bitmap set , which is the actual solution :)


On Fri, Jun 8, 2012 at 7:58 PM, partha sarathi Mohanty 
partha.mohanty2...@gmail.com wrote:

 @saurabh: why would u count all??? just see while counting if the bitmap
 is set.. then return the char.

 On Fri, Jun 8, 2012 at 4:33 PM, Saurabh Yadav saurabh...@gmail.comwrote:

 order of hashing and counting is important
 eg. abba
 if we do hashing by characters 'a' is stored before 'b'
 and count of both is 2 at the end and when we process this we give result
 'a' (because 'a' comes before 'b' )which is wrong
 because 'b' is the first repeated character.


 Thanks  Regards
 Saurabh

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


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




-- 
Thanks  Regards
Saurabh Yadav

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

2012-05-23 Thread Saurabh Yadav
+1 mithun kumar !!

using bit array or bitmap index gives the best solution ( O(n) )
the only limitation is we should know the maximum limit of the number,
which is provided in this problem :D


Thanks  Regards
Saurabh Yadav

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

2012-01-30 Thread Saurabh Yadav
+1 @atul anand

On Mon, Jan 30, 2012 at 12:31 PM, atul anand atul.87fri...@gmail.comwrote:

 @Mihir : actually you are using linked listso you are keep on adding
 the nodes but not removing it..hence...you are getting wrong output..

 i guess this should be done to fix the code.


 public static void paths(Node node, LinkedListInteger list) {
if(node == null) return;
list.add(node.data);

if(node.left == null  node.right == null) {
   print(list);
}
else {
   paths(node.left, list);

 *  removeLastNodefromLinkedList();*
   paths(node.right, list);

*   removeLastNodefromLinkedList();*

}

 r*emoveLastNodefromLinkedList();*

 }

 public static void print(LinkedListInteger list) {
System.out.println(Contents of list:  + list);
 }



 On Mon, Jan 30, 2012 at 11:41 AM, Mihir Kulkarni mihirk...@gmail.comwrote:

 I only intend to print the root to leaf paths. The correct output should
 be:
 721
 725
 It works fine when I use array instead of LinkedList.

 cheers,
 Mihir Kulkarni
 Graduate Student
 University of California, Irvine
 http://goo.gl/CvRcG



 On Sun, Jan 29, 2012 at 10:06 PM, Rujin Cao drizzle...@gmail.com wrote:

 Is the correct output   7 2 1 5 ?

 Did you intend to print the leaf node ?

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




-- 
Thanks  Regards
Saurabh Yadav

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

2012-01-29 Thread Saurabh Yadav
may be because when you compare unsigned number with signed number ,the
signed will changed to unsigned type and when signed will changed to
unsigned type, it's MSB is one ,so  y will be greater than x

i am not sure about the reason i gave !!

On Sun, Jan 29, 2012 at 2:25 PM, Ashish Sachdeva ashish.asachd...@gmail.com
 wrote:

 http://ideone.com/Ily5v

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




-- 
Thanks  Regards
Saurabh Yadav

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

2012-01-28 Thread Saurabh Yadav
check this  blog
http://nlpb.blogspot.com/2011/01/spell-checker.html

On Sun, Jan 29, 2012 at 3:07 AM, Ravi Ranjan ravi.cool2...@gmail.comwrote:

  i wanna write the spell check function

 like when we put some word with spelling mistake then it tell the most
 suitable word matching to it( green error line of spelling in MS-Word)

 i used  levenshtein distance  algorithm to find the subset from the
 dictionary

 but it is a linear search... and takes much..

 so is there any other data structure or approach to solve the problem to
 reduce complexity... or levenshtein distance  algorithm can be used
 in some other 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.




-- 
Thanks  Regards
Saurabh Yadav

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