Re: [algogeeks] Re: Valid Array

2010-12-10 Thread fenghuang
@mohan, when the num of repeatation is bigger than 1, it may be wrong,please
check {1, 1, 2, 5, 6, 6}

On Fri, Dec 10, 2010 at 12:41 PM, mo...@ismu mohan...@gmail.com wrote:

 i did nt get this xor part in adithya solution

 check if  this works

 array is valid if satisfy 2 conditions
 1.max-min=n-1
 2.there should be no repeatations

 first one can be done in O(n)
 for second

 check 1xor2xor...xorn=(a[1]-min+1)xor(a[2]-min+1)xor..
 if both are equal there are no repeatations

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



[algogeeks] Microsoft interview question

2010-12-10 Thread GOBIND KUMAR
Help me in solving this problem...   Define a data struct for the
search engine which will represent whether

given word is there in the document or not .It  should be fast.

-- 
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] Microsoft interview question

2010-12-10 Thread ankit sablok
just search for the word in the document using an efficient string matching
algorithm
use Knuth Morris Pratt algorithm as it runs in O(m) time.

or use a data structure called TRIE
where u can search for the word in O(1) time any suggestions are always
welcomed

On Fri, Dec 10, 2010 at 3:13 PM, GOBIND KUMAR gobind@gmail.com wrote:

 Help me in solving this problem...   Define a data struct for the search 
 engine which will represent whether

 given word is there in the document or not .It  should be fast.

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



[algogeeks] Re: program for evaluation of remainders

2010-12-10 Thread ankit sablok
@Dave
we will use residues then i think the property of modulus

1!mod997 + 2!mod997 + 3!mod997 .. + 997!mod997

i just proposed the solution using congruences for the case
nN

can u generalize the problem using congruences if so then please post
it
thnanx in advance

On Dec 9, 2:13 am, Dave dave_and_da...@juno.com wrote:
 @Ankit: So how does that work with, e.g., N = n = 997? I.e., what is
 the calculation?

 Dave

 On Dec 8, 11:33 am, ankit sablok ankit4...@gmail.com wrote:



  @ all the authors thanx for the suggestions actually wt i know about
  the problem is i think we can solve the problem mathematically if we
  know about congruences

  for instance
  if N=100
  1! + 2! + . + 100!
  and n=12

  we find that
  4!mod24=0

  hence the above equation reduces to the
  (1!+2!+3!)mod 12 =9
  hence the answer is 9

  so can anyone write a program for this logic

  On Dec 8, 6:19 pm, ankit sablok ankit4...@gmail.com wrote:

   Q) can anyboy find me the solution to this problem

   Given an integer N and an another integer n we have to write a program
   to find the remainder of the following problems
   (1! + 2! + 3! + 4! + . + N!)mod(n)

   N=100
   n=1000;

   please help me write a program for this problem
   thanx in advance- Hide quoted text -

  - Show quoted text -- 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 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] Microsoft interview question

2010-12-10 Thread ADITYA KUMAR
@ankit
u can'nt use TRIE
becoz , input will be given in form of text
so generating the TRIE will be much expensive than linear search

On Fri, Dec 10, 2010 at 3:13 PM, GOBIND KUMAR gobind@gmail.com wrote:

 Help me in solving this problem...   Define a data struct for the search 
 engine which will represent whether

 given word is there in the document or not .It  should be fast.

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




-- 
Regards
Aditya Kumar
B-tech 3rd year
Computer Science  Engg.
MNNIT, Allahabad.

-- 
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] Microsoft interview question

2010-12-10 Thread manoj lalavat
it will give you an idea.

http://en.wikipedia.org/wiki/Full_text_search

On Fri, Dec 10, 2010 at 4:03 PM, ADITYA KUMAR aditya...@gmail.com wrote:

 @ankit
 u can'nt use TRIE
 becoz , input will be given in form of text
 so generating the TRIE will be much expensive than linear search

 On Fri, Dec 10, 2010 at 3:13 PM, GOBIND KUMAR gobind@gmail.comwrote:

 Help me in solving this problem...   Define a data struct for the search 
 engine which will represent whether

 given word is there in the document or not .It  should be fast.

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




 --
 Regards
 Aditya Kumar
 B-tech 3rd year
 Computer Science  Engg.
 MNNIT, Allahabad.

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




-- 
--
Manoj Lalavat

-- 
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] just confirming my answer

2010-12-10 Thread ankit sablok
Q) an n-input m-output boolean function is defined as follows

(F:{True,False}^n-{True,False}
^m)

find the number of n X 1 functions meaning n inputs and 1 output
and n X m funcrtions meaning n inputs and m outputs

my answer

at any time we can reduce the problems as follows

in the domain we will always be havibg n input variables and the co-
domain can be thought of as having 2 values {True and False}
condisering this i get the number of n X 1 functions as
2^n. Please do suggest me the alternative if i am wrong. thanx in
advance

and the nswer reamins the sam for me in case of finding the number of
n X m functions.

Please help me out if i m wrong in solving this thanx in advance

-- 
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] Microsoft interview question

2010-12-10 Thread ankit sablok
then u can just use or build a dynamic dictionary of words as done in LZW
coding such that if the word is there in the dictionary it just gives u the
indx of the word and if its not it just adds that word to the dictionary any
suggestions are always welcomed thnx in advance

On Fri, Dec 10, 2010 at 4:08 PM, manoj lalavat manoj.lala...@gmail.comwrote:

 it will give you an idea.

 http://en.wikipedia.org/wiki/Full_text_search


 On Fri, Dec 10, 2010 at 4:03 PM, ADITYA KUMAR aditya...@gmail.com wrote:

 @ankit
 u can'nt use TRIE
 becoz , input will be given in form of text
 so generating the TRIE will be much expensive than linear search

 On Fri, Dec 10, 2010 at 3:13 PM, GOBIND KUMAR gobind@gmail.comwrote:

 Help me in solving this problem...   Define a data struct for the 
 search engine which will represent whether

 given word is there in the document or not .It  should be fast.

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




 --
 Regards
 Aditya Kumar
 B-tech 3rd year
 Computer Science  Engg.
 MNNIT, Allahabad.

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




 --
 --
 Manoj Lalavat


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



[algogeeks] Re: Microsoft interview question

2010-12-10 Thread ligerdave
@aditya
there is always trade-off. for what it's asking, TRIE is probably the
fastest. the problem already stated, using data structure, which to
me, means, you index a document. indexing is expensive, but it's
overhead process and it has nothing to do w/ finding an existing word
in a doc.

On Dec 10, 5:33 am, ADITYA KUMAR aditya...@gmail.com wrote:
 @ankit
 u can'nt use TRIE
 becoz , input will be given in form of text
 so generating the TRIE will be much expensive than linear search

 On Fri, Dec 10, 2010 at 3:13 PM, GOBIND KUMAR gobind@gmail.com wrote:
  Help me in solving this problem...       Define a data struct for the 
  search engine which will represent whether

  given word is there in the document or not .It  should be fast.

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

 --
 Regards
 Aditya Kumar
 B-tech 3rd year
 Computer Science  Engg.
 MNNIT, Allahabad.

-- 
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] Re: program for evaluation of remainders

2010-12-10 Thread Dave
@Ankit: Why not just use the algorithm I proposed in
http://groups.google.com/group/algogeeks/msg/2941ab071a39517c:

x = 0;
for( i = (n  N ? n : N) ; i  0 ; --i )
x = (i * x + i) % n;

Dave

On Dec 10, 4:23 am, ankit sablok ankit4...@gmail.com wrote:
 @Dave
 we will use residues then i think the property of modulus

 1!mod997 + 2!mod997 + 3!mod997 .. + 997!mod997

 i just proposed the solution using congruences for the case
 nN

 can u generalize the problem using congruences if so then please post
 it
 thnanx in advance

 On Dec 9, 2:13 am, Dave dave_and_da...@juno.com wrote:



  @Ankit: So how does that work with, e.g., N = n = 997? I.e., what is
  the calculation?

  Dave

  On Dec 8, 11:33 am, ankit sablok ankit4...@gmail.com wrote:

   @ all the authors thanx for the suggestions actually wt i know about
   the problem is i think we can solve the problem mathematically if we
   know about congruences

   for instance
   if N=100
   1! + 2! + . + 100!
   and n=12

   we find that
   4!mod24=0

   hence the above equation reduces to the
   (1!+2!+3!)mod 12 =9
   hence the answer is 9

   so can anyone write a program for this logic

   On Dec 8, 6:19 pm, ankit sablok ankit4...@gmail.com wrote:

Q) can anyboy find me the solution to this problem

Given an integer N and an another integer n we have to write a program
to find the remainder of the following problems
(1! + 2! + 3! + 4! + . + N!)mod(n)

N=100
n=1000;

please help me write a program for this problem
thanx in advance- Hide quoted text -

   - Show quoted text -- Hide quoted text -

  - Show quoted text -- 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 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] Row Major Array to Column Major Array

2010-12-10 Thread Prims
Write program for converting the row major matrix stored in array to
column major matrix

for example, if the matrix is

1 2 3
4 5 6

then it is stored in array A = {1,2,3,4,5,6}
I need to convert this Array into Column major matrix which is A =
{1,4,2,5,3,6}

-- 
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] Re: Row Major Array to Column Major Array

2010-12-10 Thread juver++
This is a very simple problem. Are you asking for the code or approach?
I don't think it is ok for complete possible hw task for you from
scratch.

-- 
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: Largest rectangle in a binary matrix

2010-12-10 Thread juver++
You may check the following page:
http://e-maxx.ru/algo/maximum_zero_submatrix.
It is in Russian, however it contains code in C++. Also you may try to
translate it in English.

-- 
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] Re: Row Major Array to Column Major Array

2010-12-10 Thread Dave
See 
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.101.1017rep=rep1type=pdf.

Dave

On Dec 10, 8:43 am, Prims topcode...@gmail.com wrote:
 Write program for converting the row major matrix stored in array to
 column major matrix

 for example, if the matrix is

 1 2 3
 4 5 6

 then it is stored in array A = {1,2,3,4,5,6}
 I need to convert this Array into Column major matrix which is A =
 {1,4,2,5,3,6}

-- 
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: Microsoft interview question

2010-12-10 Thread ADITYA KUMAR
@ligerdave
agree with u :)





-- 
Regards
Aditya Kumar
B-tech 3rd year
Computer Science  Engg.
MNNIT, Allahabad.

-- 
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] Re: program for evaluation of remainders

2010-12-10 Thread haxxpop
@Dave

Because he wants to optimize it
if we can get the boundary of running time, we'll get the faster
algorithm

haxxpop

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