Re: [algogeeks] Re: Find all words in given character Matrix

2013-01-18 Thread Raghavan
> m e m o > > valid words > bat > at > be > to > am > me > memo > > print them, not required unique list > > I will at each (i,j) --search up, down, left and right for words > > any better way? > > -- > > > -- Thanks and Regards, Raghavan KL --

[algogeeks] Google Interview question - Python

2012-11-01 Thread Raghavan
I got this question set in google interview, do any one have some knowledge how to do this, One way of imagining a lazy stream implementation in python is any class that implements the method: popNext() which returns the next element of the stream, if any, otherwise None. 1. Write the following c

Re: [algogeeks] INTERVIEW QUESTION

2012-10-26 Thread Raghavan
ps://groups.google.com/d/msg/algogeeks/-/ZaItRf_9A_IJ. > > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.goog

Re: [algogeeks] Missing Number Problem

2012-10-05 Thread Raghavan
p, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Thanks and Regards, Raghavan KL -- You received this message because you are subscribed to the Google Groups "Algorithm

[algogeeks] Need links for Problem solving interview questions(non DS and algorithmic) probably with how to reach a solution

2012-07-11 Thread raghavan M
hi I am looking for some web links where i can find problem solving questions and method that one can use to solve the problems that are asked in interviews.Please let me know if you came across one. Thanks Rag -- You received this message because you are subscribed to the Google Groups "Algo

Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-06-29 Thread raghavan M
post.Kindly refer to that post. Saurabh Singh B.Tech (Computer Science) MNNIT  blog:geekinessthecoolway.blogspot.com On Fri, Jun 29, 2012 at 10:41 AM, raghavan M wrote: Hi >Question as in subject > > >*No extra space (can use one extra space)-O(1) max > >*No order change allowed &g

Re: [algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-06-29 Thread raghavan M
The main idea of this question is *not to change order of occurrence".Dutch National flag & other swapping like quick sort will change the order of occurrence of number try yourself with simple example for proof. From: Ravi Ranjan To: algogeeks@googlegroups.co

[algogeeks] MS Question: Segregrate positive and negative nos in array without changing order

2012-06-29 Thread raghavan M
Hi Question as in subject *No extra space (can use one extra space)-O(1) max *No order change allowed example: input : 1,-5,2,10,-100,-2 output: -5,-10,-100,1,2 input : -1,-5,10,11,15,-500,200,-10 output : -1,-5,-10,-500,-10,10,11,15 Thanks Raghavn -- You received this message because you a

Re: [algogeeks] trie display

2012-06-28 Thread raghavan M
tire will always contain the link to all its children.This problem is just printing out the children once the key is fully reached. ie., search for abc in trie print all the children of c node. Raghavan From: deepikaanand To: Algorithm Geeks Sent

Re: [algogeeks] Programming Question

2012-06-22 Thread raghavan M
Instead of doing hashing why cant you jut sort array and print the First letter when it changes.(Anyway the output you printed looks sorted within the hash bucket).So it will reduce the complexity of "hashing" and no extra storage. From: Bhaskar Kushwaha To:

Re: [algogeeks] Adobe interview question

2012-06-22 Thread raghavan M
Make all constructors private. From: himanshu kansal To: Algorithm Geeks Sent: Friday, 22 June 2012 1:44 PM Subject: [algogeeks] Adobe interview question How will u implement an abstract class in c++ w/o using pure virtual function??? will making all the c

Re: [algogeeks] Re: Run Length Decoding... inplace

2012-03-25 Thread raghavan M
'ee' left side by 1  From: atul anand To: algogeeks@googlegroups.com Sent: Saturday, 24 March 2012 4:32 PM Subject: Re: [algogeeks] Re: Run Length Decoding... inplace @raghavan: wont work...take input as a1b1c4...it willl fail. read

Re: [algogeeks] Re: Run Length Decoding... inplace

2012-03-24 Thread raghavan M
For sake of in-place Instead of doing it from the "Start" we can do it from the "end" in which case, the data precision wont be lost. Eg: a1b2c3d4 start with d4 a1b2c3 now in next loop a1b2ccc- here we have to do a)reallocation and b)copy the last 3 from next  one it is more swaps

Re: [algogeeks] Obstacle Avoidance

2011-12-28 Thread Raghavan
his group, send email to algogeeks@googlegroups.com. > To unsubscribe from 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 and Regards, Raghavan KL -- You rec

[algogeeks] Exclusively For You

2011-12-15 Thread divya raghavan
I like this offer http://www.chrisbeck.de/inf.php It could be interesting for you, too -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send emai

Re: [algogeeks] Any ideas on project on data mining ??

2011-08-30 Thread Raghavan
lgogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Thanks and Regards, Raghavan KL -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post

[algogeeks] Find square root a number

2011-08-29 Thread Raghavan
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 unsubs

Re: [algogeeks] 2 Binary trees are isomorphic?

2011-08-27 Thread Raghavan
eks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- Thanks and Regards, Raghavan KL -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to

Re: [algogeeks] Re: Given an array, find out whether there exists a triplet which can form sides of triangle.

2011-08-22 Thread Raghavan
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

Re: [algogeeks] how to find median of two sorted arrays

2011-08-18 Thread Raghavan
gt;> 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

[algogeeks] how to find median of two sorted arrays

2011-08-18 Thread Raghavan
How to find(efficiently) the median of two sorted arrays? ex: 1 arr1 => 2,4,5,6,18 arr2 => 5,10,25,30 *answer : 6* * * ex:2 arr1 => 12,15,17,30,35 arr2 => 16,18,40 *answer : 17+18 / 2 = 17.5* * * Share your ideas on it. * * -- Thanks and Regards, Raghavan KL -- You received

Re: [algogeeks] Max possible numbers in incremental order

2011-08-17 Thread Raghavan
epartment of Computer Engineering > National Institute of Technology Kurukshetra > Kurukshetra - 136119 > Haryana, India > > > > > On Wed, Aug 17, 2011 at 8:26 AM, Raghavan wrote: > >> >> >> Given an unsorted array (A), find the max size of set in whi

[algogeeks] Max possible numbers in incremental order

2011-08-17 Thread Raghavan
index. 2. It can skip any numbers which comes in between the array (here we skipped {7, 1, 6}). how to do this? -- 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, sen

[algogeeks] how to solve this

2011-08-16 Thread Raghavan
return 0. Expected worst-case time complexity: O(n log n) Expected worst-case space complexity: O(1) -- Thanks and Regards, Raghavan KL -- Thanks and Regards, Raghavan KL -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post

[algogeeks] how to find triangular property

2011-08-16 Thread Raghavan
A[0] = 10A[1] = 2A[2] = 5 A[3] = 1A[4] = 8A[5] = 20 Triplet (0, 2, 4) is triangular. -- 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 al

Re: [algogeeks] array question

2011-08-16 Thread Raghavan
(1); On Tue, Aug 16, 2011 at 3:20 PM, MAC wrote: > The question needed o(1) space and o(n) time ... o(n) map approach is > obviously fine but space is taken up ... > > > On Tue, Aug 16, 2011 at 2:38 PM, Raghavan wrote: > >> @sukran: >> If you were asking for the

Re: [algogeeks] array question

2011-08-16 Thread Raghavan
p, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Thanks and Regards, Raghavan KL -- You received this message because you are subscribed to the Google Groups "Algorithm G

Re: [algogeeks] array question

2011-08-16 Thread Raghavan
@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- 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, s

Re: [algogeeks] Need Pointers for dynamic programming concept & problems

2011-08-13 Thread Raghavan
ogeeks@googlegroups.com. > To unsubscribe from 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 and Regards, Raghavan KL -- You received this message beca

Re: [algogeeks] String Question

2011-08-13 Thread Raghavan
.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- 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 al

Re: [algogeeks] Re: Problems on Linked List

2011-08-12 Thread Raghavan
First question: - .Read the data from the first list and put it in a stack - Traverse the next list and compare by reading elements from the stack - This would solve it Second question: - Take an list like 1->2->-3->4 - If you are given with 2, juz copy the value and reference of

Re: [algogeeks] Remove spaces

2011-08-12 Thread Raghavan
ho thatz interesting, can you please point down the steps On Fri, Aug 12, 2011 at 3:53 PM, sagar pareek wrote: > and in O(1) space > > > On Fri, Aug 12, 2011 at 3:53 PM, sagar pareek wrote: > >> easy can be done in O(n) time and in O(1) >> >> >> On Fri, A

[algogeeks] Remove spaces

2011-08-12 Thread Raghavan
A huge paragraph has irregular spaces between the words, how to "effectively" we can make everything to single space. Example : "My name is xyz" Should to converted to : "My name is xyz" -- Thanks and regards, Raghavan.K.L -- You received this mes

Re: [algogeeks] MS question

2011-08-09 Thread Raghavan
Map charCountMap = new HashMap(); for(String char : characters.length){ if(charCountMap.containsKey(char){ charCountMap.get(char)++; }else{ charCountMap.put(char,1); } } later read the map and print the count and key it might suffice. On Tue, Aug 9, 2011 at 6:37 PM, ankit sambyal wrote: > @s

Re: [algogeeks] Paypal interview Questions

2011-08-06 Thread Raghavan
q2: Maintain a map it would solve the issue. On Sat, Aug 6, 2011 at 12:28 PM, dilip makwana wrote: > FOR Q2> > > int i, j; > > > > /* new length of modified array */ > > > int NewLength = 1; > > > > for(i=1; i< Length; i++){ > > > >for(j=0; j< NewLength ; j++) > > > >{ > > > > if(

Re: [algogeeks] pls help

2011-08-05 Thread Raghavan
A *trie *could help here where the number of children for each node matches the required length. On Fri, Aug 5, 2011 at 12:20 PM, Kamakshii Aggarwal wrote: > given a set of letters and a length N, produce all possible output.(Not > permutation). For example, give the letter (p,o) and length of 3,

Re: [algogeeks] Re: GOOGLE QUESTION

2011-07-08 Thread divya raghavan
since its a phone number storing problem, you can sort the numbers and store the differences. That way you can generate the required number on the go On Thu, Jun 30, 2011 at 4:39 AM, juver++ wrote: > @Navneet > Please read problem again - it is about memory efficient storing. > > -- > You receiv

Re: [algogeeks] Google Search by Image

2011-06-21 Thread Raghavan
An idea which strikes to mind is, 1.Initially to form a map based on the text and all related text to it.[text,images]map 2.Also make a bitwise manipulation of every image and relate the texts to it.[imagebitwise,texts] map 3.If a image is put forth for search, check the texts from [imagebitwise,

[algogeeks] How to form a tree based on api which states the property of each node

2011-06-15 Thread Raghavan
There is a tree which denotes 4 directions, Node direction{ direction *side1,*side2,*side3,*side4; }; makeTree(){ direction *tree; getdirection(tree,1); getdirection(tree->right,2); getdirection(tree->left,1); /* how to form such a tree root side1 side2 side3 side4 side

Re: [algogeeks] Finding shortest path in 4-ary tree

2011-06-14 Thread Raghavan
think we can find the shortest path >>> >>> >>> >>> On Tue, Jun 14, 2011 at 5:37 PM, Raghavan wrote: >>> >>>> Hi, >>>>How to find the shortest path in a 4-ary tree in an optimal way? >>>> >>>> Node

[algogeeks] Finding shortest path in 4-ary tree

2011-06-14 Thread Raghavan
Hi, How to find the shortest path in a 4-ary tree in an optimal way? Node tree{ Node *left,*right,*top,*bottom; int val; }; Let the above given be the tree structure. -- Thanks and regards, Raghavan.K.L -- You received this message because you are sub

[algogeeks] Re: Lucky numbers

2009-01-06 Thread Vijay Venkat Raghavan N
13 19 27 31 > Deleting every number 7 from above. > 1 3 7 13 19 27 > > 27 is not prime and a lucky number. So the method is fine. > > Pratyush Tewari > > > > On Mon, Jan 5, 2009 at 12:30 AM, Vijay Venkat Raghavan N > wrote: > > Guys this is wrong.

[algogeeks] Re: Lucky numbers

2009-01-05 Thread Vijay Venkat Raghavan N
Guys this is wrong. Lucky number is basically a prime number if you observe the definition carefully, and this approach of determining primality obviously won't work. On Sun, Jan 4, 2009 at 7:12 PM, Channa Bankapur wrote: > Here is the C-version of the same. It tells you whether given n is lucky

[algogeeks] Re: DataStructure - Push,Pop & Find_Min in O(1)

2006-03-25 Thread Vijay Venkat Raghavan N
extract_min not possible cos that wud been a brand new sorting algorithms that runs in O(n) time.On 3/25/06, Balaji Gopalan < [EMAIL PROTECTED]> wrote:hithe extension of this prob asks whether one more function extract_min() (which returns and deletes the current minimum ) can be  implemented in O(

[algogeeks] Re: determine whether a matrix is rearrangeable

2006-03-17 Thread Vijay Venkat Raghavan N
hi, well am not really sure about this stuff, but i guess if theres a 1 in each row and each coloum initially, then it is rearrangeable. i am not able to think of a rigorous proof as of now. -VijayOn 3/18/06, kool_guy <[EMAIL PROTECTED]> wrote: Let A be a "n by n" matrix.  A is rearrangeable if t

[algogeeks] Re: Finding duplicate

2005-12-20 Thread Vijay Venkat Raghavan N
Hi, First of all to adak. This problem cannot use your logic as even if the range is from 1 to 65000, as you have given for example, i can easily pick put 4 numbers like 1,10,456,65000. The Complexity of your algo is 65000, mine wud be 4lg4 = 8. Pramod: Great point man, even I thought it had to b

[algogeeks] Re: Given N numbers & z value , find x, y such that x + y = z

2005-12-20 Thread Vijay Venkat Raghavan N
Hi Hemanth, It would be nice if you can come up with an O(n) algorithm for that, but frankly, I dont think it is possible at all. Of course, if the numbers are all in O(n) and if we can afford O(n) additional space, we can go in for a counting sort like mechanism. Or else, if numbers are not in O(

[algogeeks] Re: Given N numbers & z value , find x, y such that x + y = z

2005-12-19 Thread Vijay Venkat Raghavan N
Hi, I guess this has already been discuss in this forum before. Anyways let me give my algo here. Let us assume that the array is sorted in ascending order WLOG. let low=1 and high=n index the first and last elements while(low { if a[low]+a[high] == z, done, so break off if a[low]+a[high] 3rd ca

[algogeeks] Re: Comparing two mathematical expressions

2005-12-15 Thread Vijay Venkat Raghavan N
Hi Pramod, My algo has a long way to go. It really has to be tailored to accomodate all stray cases, dividing by a reciprocal is certainly one of them. In any case, I thought it was a fairly structured way of solving, if not all, at least say some 40% of the cases. In any case, if you want a com

[algogeeks] Re: Comparing two mathematical expressions

2005-12-14 Thread Vijay Venkat Raghavan N
Hi folks, Lets do a lexicographical sorting of the _expression_ like this: Exp Lexico (E1 Opr E2) { newE1= Lexico(E1); newE2= Lexico(E2); if( Opr is NON Commutative  ) return  "newE1 opr newE2";     //If Opr is Commutative     If newE1 lexicographicallysmallerthan newE2

[algogeeks] Re: Geometry problems

2005-12-01 Thread Vijay Venkat Raghavan N
Hi, But the 2 slopes may not have a common point. If that is not so, they are jus referring to 2 parallel lines and not 3 collinear points. -VijayOn 12/1/05, forest <[EMAIL PROTECTED]> wrote: You can do without matrix, sort ALL slopes and then find 2 adjacentequal, as sorting n^2 is O(n^2 log (n^

[algogeeks] Re: Design an algorithm

2005-11-30 Thread Vijay Venkat Raghavan N
Hi, So do u mean to say that we can leave out those numbers which are less than the median of medians and greater than the median of medians in each round? If yes, I have a case to prove this algo wrong. -VijayOn 12/1/05, pramod <[EMAIL PROTECTED]> wrote: Let M1,M2, ..., MN be the medians and let

[algogeeks] Re: Geometry problems

2005-11-30 Thread Vijay Venkat Raghavan N
hi, i have an answer to ur first question. it is n^2 lgn, but its quite a long procedure and I am sure there must be somethng better. 1. set up and nXn matrix, where the entry at (i,j) is the directed slope between points i and j. this is n^2 2. sort each row of this matrix. sorting one row is n

[algogeeks] Re: how to find Previous Prime number?

2005-11-30 Thread Vijay Venkat Raghavan N
Hi, Well lots of posts abt primality testing. But what my frnd Venks wants is not a linear algo, not something like, run down from that number till u get a prime and use an efficient method to do ur primality testing. what i presume he wants is a way of jumping over numbers without missing any pri

[algogeeks] Re: Design an algorithm

2005-11-30 Thread Vijay Venkat Raghavan N
Hi pramod, I dont get the last part of your solution. How does it leave us with n^2/4 lesser and greater than the median? Also if we leave out everythng thats lesser or greater than a number, all what should be left is the number itelf. I am missing something and plz explain your algo's last part