Search code examples
data-structuresheapadjacency-listminimum-spanning-treekruskals-algorithm

could someone help clarify this implementation of a Minimum Spanning Tree?


I am currently working on a project for data structures due in a couple days and I do not understand the instructions. We are to make a minimum spanning tree via kruskal's algorithm but also need to implement it using an ArrayBasedList, a heap, up trees, and an adjacency list. 1. These things are very confusing to me, would the heap and the up trees just be an array-based list with the things entered in a different order? or do they need their own classes? 2. What is an adjacency list? I have to return a string version of my heap, my adjacency list, and my mst. I am very nervous/confused, any help understanding how to start this is GREATLY appreciated.

the project is basically to find the minimum spanning tree of lowest cost bridges (edges) between islands (vertexes) so its a weighted graph.


Solution

  • You should first distinguish between the purpose of these data-structures. For example, you would use a adjacency list to store the graph information. Where would you use a heap? To process the edges in order. Then find out the different variations you can do with the different data-structures. The data-structures process the information differently so they may have different final time complexities. Once you manage to understand the pieces see how they fit in together and implement the algorithm.

    Consult this link for a step-by-step demonstration.