[algogeeks] Re: Pick up elements based on their priorities

2006-11-27 Thread yogesh
Hi, U can do this by decreasing priority after printing the element. U can choose any criterion to pick element at same priority level. I picked the lexiographic order. the resulting sequence is A B A B C D A B C D E --~--~-~--~~~---~--~~ You received this m

[algogeeks] Re: bipartite algorithm i guess

2006-11-27 Thread dor
a graph is 2-colourable if and only if it is bipartite a graph is bipartite if and only if it has an odd cycle you can check if a graph has an odd cycle using dfs (the ADT methods that you mentioned let you implement dfs) if you know the pseudocode you're done.. (the pseudocode is pretty straightf

[algogeeks] Re: How to check the subsequence whose some is 0 in array of both + and -ve Integers?

2006-11-27 Thread dor
The sequence could still have a subsequence of sum 0 even if the sum of the maximum sum subsequence is greater than 0. Take for instance: -2 -1 0 1 2 If 0 is in an element of the sequence, you're done. Let b[i] = the sum of the first i elements in the sequence. If b[i] = 0, for some i you're don

[algogeeks] Re: Pick up elements based on their priorities

2006-11-27 Thread L7
So rather than A A A B B B C C D D E 3 3 3 3 3 3 2 2 2 2 1 You want A B C A B D A B C D E 3 3 2 3 3 2 3 3 2 2 1 To me, that seems pretty vague. Is there a particular order you want the values in? Otherwise, A A C A B C B B D D E 3 3 2 3 3 2 3 3 2 2 1 Is another ordering that matches the patter

[algogeeks] Pick up elements based on their priorities

2006-11-27 Thread Andre
Hi, I have elements A, B, C, D and E with priorities 3, 3, 2, 2 and 1. And I want to select them spaced somehow by their priorities. Something like A, B, C, A, B, D, A, B, C, D and E ( not A, A, A, B, B, B, C, C, D, D and E ). Do you know any well know algorithm that could be used for this task?