This is a homework problem; however I just want some direction. I have to write a module graph.cpp that implements djikstra's algorithm. so far i am at the reading in module and am trying to make an array of structures. here is the code. [code=c] // Zachary Dain // CSCI 3300 Assignment 3 // tab stops: every 2 spaces #include <iostream> #include <math.h> using namespace std; enum StatusType {Done, Pending, Peripheral}; struct ListCell { ListCell* next; int adjVertex; double weight; ListCell(int v, double wt, ListCell* n) { adjVertex = v; weight = wt; next = n; } }; struct arrayOfStructs …

Member Avatar
Member Avatar
+0 forum 9

I am trying to copy a string into an array then write bits out to a file accordingly. (compression assignment). here is the code [code=c] // strnewdup(const char* s) returns a copy of a // null-terminated string, with the copy stored // in the heap char* strnewdup(const char* s) { char* space = new char[strlen(s) + 1]; strcpy(space, s); return space; } // putCodes(Node*& t, string* codes) traverses // the tree t, recording the non-leaves(0) and // leaves(1) into the correct letters code array // to identify that letter void putCodes(Node* t, string s, string* codes) { if(t->kind == leaf) …

Member Avatar
Member Avatar
+0 forum 3

The End.