I can only think of one way off the top of my head:
class IndexedDocument {
HashTableString, int index;
String contents;
/// Build an index of words and their position in the document
void buildIndex() {
for each word in document {
add word, position to index
use segment tree
http://en.wikipedia.org/wiki/Segment_tree
--
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
use suffix tree it's much faster than simple trie
with ukkonen's method you can build it in O(size of document) and then
searching in it is practically O(1)
http://en.wikipedia.org/wiki/Suffix_tree
http://www.cs.helsinki.fi/u/ukkonen/SuffixT1withFigs.pdf
On Fri, Dec 10, 2010 at 7:54 PM, ADITYA
I think the answer is (2^m)^(2^n) (or 2^(m*2^n))
For m=1, the answer is 2^2^n.
We can express the function using a truth table with 2^n entries, one
entry for each possible input set.
And each entry has (n+m) fields, represent the n inputs and m outputs.
The m*2^n output fields can be filled
each value in A and B is 0 or 1 so the sum of all elements in A (or B) is n
so the sum of all elements in C which is the sum of differences between
values in A and B is between -n and n
now we want to maximize j-i for which C[i]+C[i+1]+...+C[j] = 0
suppose that sum(i) = C[1]+C[2]+...+C[i] which is
No. You made the same mistake as I.
Try this case: {1, 2, 2, 5, 5}.
Actually, this case defeats the solution of Manmeet's, yours, and mine.
(same min/max, same sum, same xor result)
I think the key point is that the N variable cannot be determined by 1
or 2 equation constraint.
On 2010-12-10
CALL FOR PAPERS
and
Call For Workshop/Session Proposals
FCS'11
The 2011 International Conference on Foundations
of Computer Science
Date and Location: July
@amir nice solution
On Sun, Dec 12, 2010 at 11:40 AM, Amir hossein Shahriari
amir.hossein.shahri...@gmail.com wrote:
each value in A and B is 0 or 1 so the sum of all elements in A (or B) is n
so the sum of all elements in C which is the sum of differences between
values in A and B is
visit this blog
http://code-forum.blogspot.com/
and http://coders-stop.blogspot.com/
for programming puzzles.
--
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
Given that you have one string of length N and M small strings of
length L . How do you efficiently find the occurrence of each small
string in the larger one
I heard the best solution for this problem is to use generalized
suffix tree. Can any one explain the solution for this problem in
detail
KMP and RabinKarp
On Dec 12, 7:07 pm, Prims topcode...@gmail.com wrote:
Given that you have one string of length N and M small strings of
length L . How do you efficiently find the occurrence of each small
string in the larger one
I heard the best solution for this problem is to use
@Dave :but it will take more time. any other solution O(n^2).?
On Sat, Dec 11, 2010 at 7:48 PM, Dave dave_and_da...@juno.com wrote:
@Naresh: The sequence of numbers generated by this rule for any given
starting number is called a Collatz Sequence. Try googling it.
Here is a list of the
ans for 1st one is 24
On Sat, Nov 27, 2010 at 3:12 PM, vamsi achyuth vamsiachy...@gmail.comwrote:
these were the problems asked in tcs written exam.
On 27 November 2010 15:08, srinivas reddy srinivaseev...@gmail.comwrote:
@youngboy
you have to choose one value for variable only
It is NOT possible to multiply two matrices in less than O(n^2) simply
because there are n^2 elements, and you got to touch all of them at
least once!
Rakib
On 12/10/10, Luciano Junior luciano@gmail.com wrote:
Dave, thank You very much for yours information. Really, I want to
know a
@awesomeandroid
how you will use KMP in ths case, can you plz explain ?
Mohit
On Sun, Dec 12, 2010 at 8:01 PM, awesomeandroid
priyaranjan@gmail.comwrote:
KMP and RabinKarp
On Dec 12, 7:07 pm, Prims topcode...@gmail.com wrote:
Given that you have one string of length N and
i am facing problem in file handling in C
can any one suggest me how to implement them.
--
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
16 matches
Mail list logo