I think you just said the same thing I did.
I disagree. As I said, you get an approximation with wrappers. You
can track the amount of memory actually in use by the client program.
For malloc/frees that don't return memory to the OS once allocated
(this includes glibc in Linux), you can also
iterate it twice the length
max_sub_array()
{
int a[] = {200 -10 -10 -10 -10 -10 100} ;
int len = sizeof(a) / sizeof(a[0]);
int max_sum =0;
int max_till_now =0;
for(int i=0; ilen*2; i++)
{
if(max_till_now + a[i%len] 0)
max_till_now =0;
else
max_till_now += a[i%len];
if(max_sum
i think the solution requires to end at a leaf node with given sum 'k'.
if we gather the path from root till its leaf,
once we reach leaf we have root to leaf values in our path array
now create another array of same SIZE having sub_array_sum starting from
root.
we check the last value of
Hi,
Does anyone know how to find K-shortest path and K disjoint shortest
path...
--
navneet singh gaur
--
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
I think the best we can have is nlogn solution with the heap approach.
On Nov 6, 10:27 pm, Dave dave_and_da...@juno.com wrote:
@Mohit: Here is a counterexample:
10 11 52 53 54
20 21 112 113 114
30 31 122 123 124
40 41 132
I think its same as the Virtual memory
On Mon, Nov 7, 2011 at 4:22 PM, Gene gene.ress...@gmail.com wrote:
I think you just said the same thing I did.
I disagree. As I said, you get an approximation with wrappers. You
can track the amount of memory actually in use by the client program.
For
Sorry I did not realize you meant the anti-diagonal. Dave gave a good
example where the anti-diagonal also does not contain the median.
If you go back to the partitions I described, you can force the
median to be any element that appears just right or below a partition
with 1+floor(N^2) elements
@ Above
no need to have another array or nything
binTreeToBST(node *root)
{
if(!root )return;
node *newRoot;
binTreeToBSTConv(root, newRoot);
}
binTreeToBSTConv(node *old, node *new)
{
if(!old ) return;
binTreeToBSTConv(old-left, new);
probably you are mistaken about the complexity calculations,
the above algo will search for the first element in the 2D matrix,
and if you look carefully , at max n-1 match for each unsuccessful 1D
combination is done
hence complexity goes to n(n-1) or O(n^2) at max with space complexity
O(n).
try this:
sq(i, j)= k is maximum sqare possible ending at i, j and has
length k in the matrix iXj
sq(i, j) = k if {sq( i -1, j-1) AllOnes(i,0,
k) AllOnes(0, j, k)}
= 1 if sq(i, j) == 1
= 0 otherwise
On
Can you explain how a heap helps get the answer? Just to put the
elements in a heap requires O ( N^2 log (N) ) time.
On Nov 7, 4:12 pm, vikas vikas.rastogi2...@gmail.com wrote:
I think the best we can have is nlogn solution with the heap approach.
On Nov 6, 10:27 pm, Dave
@Vikas,
I think the brute force here will be combinatorial , you need to
calculate all the combinations of lucky say 4, 7, 47, 74 and then
try to find all of the moves combination which maximize this lucky
array index, may be from last to first, just for little optimization.
A bit tough
byte stuffing
On Nov 2, 2:17 am, SAMMM somnath.nit...@gmail.com wrote:
As we all know that the new and delete operator , they are inherited
and tell call constructor and destructor respectively . Now Suppose I
have One Integer variable for the base class and one more Integer
variable for the
13 matches
Mail list logo