![]() |
[Java/C++]Minimum Spanning Trees..
So I'm enrolled in -- by far -- the hardest class I've ever taken for my Comp Sci major (as of yet). It's a Design/Analysis class for Algorithms...
Has anyone implemented the Kruskal, Prim, or Dijkstra Algorithms for Minimum Spaninng Trees in Java? I'm having a very difficult time implementing these alogrithms because of the poor explanation by my professor. Searching around on google, I can't get anything more than the poor psuedo-code my instructor provided. Quote:
I've implemented it with a java class Edge which is aware of its weight and its connecting nodes. It entirely works, except the "cycle()" method. I'm not sure how to make the program aware of a cycle? Each edge has no knowledge of the next edge to be added other than its verticies and weight. AAAAAAH .. any help is appreciated, as it is approaching one week late as I've tried to implement it different ways.. |
That looks like pascel coding. The := sign gave it away.
Go to java.sun.com and punch in the search key Dijkstra and you'll get quite a few results relating to that particular algorithms |
I'm not getting anything related to the alogrithms on java.sun.com :(
|
Sorry, forgot to mention to look within the forums. Sun Microsystems doesn't offer alot of article on that but there is a lot of threads on that.
Dijkstra Search Results Kruskal Search Results |
MMMmmmmmmm...
We went over these briefly in my Algorithms class last semester. I dug up the online notes, and they skim Dijkstra's- http://www.cns.uni.edu/~wallingf/tea...session27.html Here's something I found for Kruskal's and Prim's: http://www.people.vcu.edu/~gasmerom/MAT131/mst.html I must admit.. I've forgotten these already.... But I hope that helps just a little! |
Still stuck -- god I hate programming.. if I dont sleep for the next 7 hours until work, I might get somewhere.. eyes burning already.
|
i have that same subject this semester...the prof sucks(as do most of them)
we had to make an implimentation of krustuls algo during the last lab class here it is in C good luck understanding it...all i know it worked..eureka :p Code:
#include<stdio.h> |
All times are GMT -8. The time now is 10:53 AM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project