[algogeeks] Re: what is the best solution for this kind of searching ?

2008-02-23 Thread Ridvan
I see no reason to use a sorted heap, a plain list of ranges would do as well. This will lead to O(N) algo, i prefer O(lgN). Once again, why? Even if you a heap sorted by range size, just take the smallest one, and pick the min value. After reducing the range by one, if it's zero - get rid

[algogeeks] Problem in code

2008-02-23 Thread monty 1987
Find out why this program is not working which converts list representation of graph in adjacency matrix #includeiostream using namespace std; struct node { node* point; node* next; int info; }; node * getnode(int i); void adja(int count,node **p); int main() { int

[algogeeks] Re: Problem in code

2008-02-23 Thread Vishal
Can we just not post the code here for debugging? This group more related to algorithms than implementations. If your code is not working, use debugger. On Sat, Feb 23, 2008 at 6:22 AM, monty 1987 [EMAIL PROTECTED] wrote: Find out why this program is not working which converts list

[algogeeks] Re: Frog Problem

2008-02-23 Thread Ridvan
let A=1, K=11 The recursive formula: NumberOfPaths(11) = 0; NumberOfPaths(10)=1 NumberOfPaths(9)=2; NumberOfPaths(x) = NumberOfPaths(x+1) + NumberOfPaths(x+2); we are looking for NumberOfPaths(1). Even if this looks as an streightforward solution it is O(2^n) algo. So it is fine for 11 stones