This content has been marked as final. Show 2 replies
compSciUndergrad wrote:There's a specific forum for general algorithm questions. So it's OK that you asked it, but here's not the place.
This is a general programming algorithm question opposed to specifc java based but i hope you can help
so basically back to the question, how can the 2 be compared for situations where 1 is betetr than the other or where there is a case that the 2 may not differ tooo much from each otherIt sounds like you just did. Are you being asked for something more qualitative? You can start by identifying the worst and best case complexities for each algorithm, and when they occur (for example, Quicksort is on average O(n log n) but has a worst-case complexity of O(n^2) which can be encountered if you don't randomize the pivots and the list is already sorted).
Perhaps what you need to do is prove it inductively? As in, for all graphs of N nodes and K or more edges, Prim's is better. But it seems like such a proof would require such a precise set of circumstances that it would be hard to generalize into an inductive proof.
Note: This thread was originally posted in the [New To Java|http://forums.sun.com/forum.jspa?forumID=54] forum, but moved to this forum for closer topic alignment.