I am trying to implement heap sort.
But i am not getting the correct output.
I have a structure consiting of
3 integets
int u
int v
int weight
Type: Posts; User: Khadafi
I am trying to implement heap sort.
But i am not getting the correct output.
I have a structure consiting of
3 integets
int u
int v
int weight
Hi, dont worry i figured it out.
thanks for all your help =)
Hi, I am trying this
my vector is:
vector vector 0 = 1
vector vector 1 = 2
vector vector 2 = 3
vector vector 3 = 4
vector vector 4 = 5
vector vector 5 = 6
thanks sorry i fixed it.
I now need to be able to merge 2 vectors inside the big vector
e.g. i have
vector vector 0 = 1
vector vector 1 = 2
vector vector 2 = 3
vector vector 3 = 4
vector...
Thank that works =)
Hi, thanks i understand your example now and it works =)
sorry about the MYVEC, it was just an example to show you what i mean.
Actually would i be able to change the vector so i only have...
Hi, ignore the last post I have done it.
Thanks =)
Hi, thanks i have done it using
int k = 0; // used to assign 0 to other elements
for ( int i = 0; i < num; i++ )
{
MYVEC.push_back ( vector<int>() );
Hi, I am Trying to create a vector of vectors
I have managed to create the vector structure
but now i need to add elements to it with a particular sequence
for example if i call the function,...
oh okay.
thanks very much.
thats what i was thinking but i remember someone telling me that you shouldnt make things global like that.
but thanks it all seems to be working, i really appreciate everyones help so much
...
bool compareByCost (const WEdge &lhs, const WEdge &rhs)
{
return lhs.wCost < rhs.wCost;
}
thanks hk_mp5kpdw, i have done that to simply push_back, thats great =) thanks
Elysia...i am not sure what to do, i have put the function outside, and put a function header, but it keeps saying...
Hi, when i move it outside, it says that WEdge is undefined.
do i also need a declaration of the function at the top as it is a function?
thanks
11260
i have attached a screenshot of the errors i am getting
thanks
Hi thanks for all your help so far, i am trying
bool compareByCost (const WEdge &lhs, const WEdge &rhs)
{
return lhs.wCost < rhs.wCost;
}
Hi, yes i understand that, I looked at the link given by Elysia but it seems very complex.
I dont understand what this code is doing, is it saying that if something on the left hand side is less...
Hi, i have never done anything like that before, could you explain further, or like explain what the parts are doing
thanks
Hi, dont worry about the last post i figured out how to do it.
i am confused about sorting
i am trying
std::sort(myEdges.begin.wCost, myEdges.end.wCost());
but it dosnt work and dosnt...
thanks it does compile.
I cant seem to print out data from the vector now, e.g. i have tried
for(int i=0; i<myEdges.size(); i++)
{
cout << "data" << i << " Is: " << myEdges[i] << "\n";
}
the data types can be integers.
the sort speed dosnt really matter, I can use Bubble sort etc like i have done in the past but would like to use the std::sort function this time
do you mean...
thanks for the prompt response.
basically its to hold data for a minimum spanning tree algorithm.
so i need a from, to and a weight to make up one EDGE, so for example point 1 to point 2 with a...
Hi, i am trying to create a vector a structure type
my code so far is
struct WEdge
{
vector<int>From; // an array for u points
vector<int>To; // an array for v points
Hi, sorry I was working on code to make sure that the points i need to create a graph for are correct.
I have tried your tutorial
and can get a graph to print great using the code
for...
Hi, sorry I dont know about gotoxy() ?
the code i tried is to sort all the element (xy) by the y so that the first element xy element has the largest y, and then go through a loop to print each x...