can u plz elaborate how min heap helps to find most repeating words
On Oct 21, 6:40 am, ashish agarwal ashish.cooldude...@gmail.com
wrote:
use a array of 10 and apply min heap
On Thu, Oct 21, 2010 at 7:05 PM, Vinay... vinumars...@gmail.com wrote:
how do u find 10 most repeating words on a
for a large file, you probably would want to use external sort. kinda
like a map-reduce concept. it's actually how sortuniq kinda stuff
work in unix/linux when you try to find some TOP X
again, we are talking about the memory might not hold the entire file
On Oct 21, 9:35 am, Vinay...
Ok, if you look at the inner loop, it is -
for ( j = i to j = 0 ) {
sum[j] += A[ i]
product[j] *= A [ i]
}
This is as good as executing -
sum[i] = sum [ i ] + A[ i ] --- ( 1 )
sum[i-1]= sum[i-1]+ A[i] ( 2 )
--
---
---
sum[0] = sum[ 0]+A[i] -- ( i )
http://www.informatik.uni-ulm.de/acm/Locals/2007/output/
On 2010-10-21 18:59, ANUJ KUMAR wrote:
please give me its output file also so that i can check mine
On 10/21/10, ANUJ KUMARkumar.anuj...@gmail.com wrote:
thanks
On 10/21/10, juver++avpostni...@gmail.com wrote:
Please have a look at
@ dev : i said eariler it work only if max number is less than no of values
in array ...
--
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
you have an array of n integers, how would you find the integer pairs
which sum to m? complexity?
if we use hash table then should we implement efficient hash table in c
++?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this
@rajan
array 1 - {2,2}
array 2 - { 4,4,1}
according 2 you .. unique is {(4+4+1)-(2+2)}=5 ? but it is not...
--
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
@Mohit: Rajan clearly sais that array 2 contains all the elements of array1
+ 1 extra element..Your example doesn't do so...By the way the method
suhhested by Rajan is not universal.It is not necessary that array 2 will
contain the same elements as array 1...XOR method will be the best...
--
You
You may use C++ bitset. It requires O(Max / 8) bytes for space.
If the array is sorted, there is O(n) solution with O(1) space
complexity:
keep two pointers, left = 0 and right = n - 1;
while (l r) {
int diff = A[l] + A[r] - m;
if (diff 0) --r;
else if (A[l] + A[r] 0) ++l;
else break;
if array is not sorted, then how u are solving it in O(n) using
bitset.
will u plz explain??
On Oct 22, 9:15 pm, juver++ avpostni...@gmail.com wrote:
You may use C++ bitset. It requires O(Max / 8) bytes for space.
If the array is sorted, there is O(n) solution with O(1) space
complexity:
keep
@ mahesh
i didnt get ur algo. why it will work??
plz expalin..
On Oct 20, 3:49 pm, Mahesh_JNU mahesh.jnumc...@gmail.com wrote:
Just add the number of the array and let the sum is S. Its complexity is
O(n).
Now XOR all elements of the array and say the result is X_SUM.Its complexity
is O(n).
Iterate over an array and add number to the set (simply set up an
appropriate bit there).
Every time check if there exists in the set number A = m -
currentNumber (check corresponding bit in the bitset).
So the complexity is O(N).
Additional care should be taken for working with negative numbers.
@Ligerdave: Hey, the King James version of the Bible is only about
600,000 words. I use the Bible as an example only because it is a
fairly large book. Maybe we are talking 10 megabytes to store the
whole thing, seeing that there are some long words such as Maher-
shalal-hash-baz, a name that
Counting Boolean
Parenthesizationshttp://people.csail.mit.edu/bdean/6.046/dp/.
You are given a boolean expression consisting of a string of the symbols
'true', 'false', 'and', 'or', and 'xor'. Count the number of ways to
parenthesize the expression such that it will evaluate to true. For example,
14 matches
Mail list logo