[algogeeks] Re: How to solve this problem efficiently?

2007-09-04 Thread Ray
I know the naive method. It's very straight. Just maintain an index array which records the index of the books. whenever one book is removed then update all elements in the index array after its index. It runs O (M N). I'd like to know is there any efficent data structure to speedup it? Thanks.

[algogeeks] How to solve this problem efficiently?

2007-09-04 Thread Ray
He has lost many books, since many of his friends borrow his books and never bother to return them. He does not want to lose any more books and has decided to keep a record of all books that he lends to his friends. To make the task of borrowing a book a little difficult, he has given the followin

[algogeeks] Re: graph problem

2007-09-04 Thread Ray
I think Floyd Bellman method can solve it. We can get any pair vertex distance and find the largest one. That's the diameter of a graph. But this method is not DP but iterative approach. On Sep 1, 2:55 pm, mirchi <[EMAIL PROTECTED]> wrote: > can anyone explain me how to find the diameter of a g

[algogeeks] Re: An interesting numerical sequence problem

2007-09-04 Thread Sticker
To Adak, I must clarify the problem. When I mean consecutive numbers, I am not saying the values are consecutive, but the positions of the numbers. So in sequence of number {2, 4, 5, 7, 1, 23, 41, 12}, {5, 7, 1} is a segment of consecutive numbers. But {2, 5, 7} is not because 4 is missed between

[algogeeks] Re: cormen solutions

2007-09-04 Thread TheTravellingSalesman
Thanks, This one is helpgul On Sep 3, 7:36 am, rlacsd <[EMAIL PROTECTED]> wrote: > u can download them from my site asees.275mb.com > > On Sep 1, 8:40 pm, rahul <[EMAIL PROTECTED]> wrote: > > > > > can neone give me link to cormen solutions pls > > its very urgent > > pls give me link at [EMAIL

[algogeeks] Re: An interesting numerical sequence problem

2007-09-04 Thread adak
Well, now you've gone and given me Sicker shock! :) Dilly of a problem, I must say!! I can't offer you a possible solution, but I'm curious what algorithms you've tried for this problem, and what was the resulting performance? I was thinking, something like: Scan the numbers, putting all sequ

[algogeeks] Re: A dynamic problem

2007-09-04 Thread mukesh agrawal
I think this should help you: Suppose, M[i,j,a] represents the number of ways to parenthesize the sub-array from i to j so as to produce the result a. Similarly, M[i,j,b] and M[i,j,c] . I think you can implement this using three dimensional array with the third dimension of constant size i.e 3, in

[algogeeks] Re: In-place Counting Sort

2007-09-04 Thread Ramaswamy R
Counting sort doesn't work that way. The algo inherently requires O(N) storage for the counting array which effectively makes the algorithm running time O(N). If the range of values were known before hand, then the counting array would be of fixed size thus catering to what you need. But if the ran