Search:

Type: Posts; User: Khadafi

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Replies
    6
    Views
    1,288

    Heap Sort Problem

    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
  2. Replies
    11
    Views
    1,680

    Hi, dont worry i figured it out. thanks for all...

    Hi, dont worry i figured it out.
    thanks for all your help =)
  3. Replies
    11
    Views
    1,680

    Hi, I am trying this my vector is: vector...

    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
  4. Replies
    11
    Views
    1,680

    thanks sorry i fixed it. I now need to be able...

    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...
  5. Replies
    11
    Views
    1,680

    Thank that works =)

    Thank that works =)
  6. Replies
    11
    Views
    1,680

    Hi, thanks i understand your example now and it...

    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...
  7. Replies
    11
    Views
    1,680

    Hi, ignore the last post I have done it. Thanks...

    Hi, ignore the last post I have done it.
    Thanks =)
  8. Replies
    11
    Views
    1,680

    Hi, thanks i have done it using int k =...

    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>() );
  9. Replies
    11
    Views
    1,680

    Vector Of Vectors

    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,...
  10. Thread: Vector Struct

    by Khadafi
    Replies
    28
    Views
    2,170

    oh okay. thanks very much.

    oh okay.

    thanks very much.
  11. Thread: Vector Struct

    by Khadafi
    Replies
    28
    Views
    2,170

    thats what i was thinking but i remember someone...

    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
    ...
  12. Thread: Vector Struct

    by Khadafi
    Replies
    28
    Views
    2,170

    bool compareByCost (const WEdge &lhs, const WEdge...

    bool compareByCost (const WEdge &lhs, const WEdge &rhs)
    {
    return lhs.wCost < rhs.wCost;
    }
  13. Thread: Vector Struct

    by Khadafi
    Replies
    28
    Views
    2,170

    thanks hk_mp5kpdw, i have done that to simply...

    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...
  14. Thread: Vector Struct

    by Khadafi
    Replies
    28
    Views
    2,170

    Hi, when i move it outside, it says that WEdge is...

    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
  15. Thread: Vector Struct

    by Khadafi
    Replies
    28
    Views
    2,170

    11260 i have attached a screenshot of the...

    11260

    i have attached a screenshot of the errors i am getting

    thanks
  16. Thread: Vector Struct

    by Khadafi
    Replies
    28
    Views
    2,170

    Hi thanks for all your help so far, i am trying ...

    Hi thanks for all your help so far, i am trying



    bool compareByCost (const WEdge &lhs, const WEdge &rhs)
    {
    return lhs.wCost < rhs.wCost;
    }
  17. Thread: Vector Struct

    by Khadafi
    Replies
    28
    Views
    2,170

    Hi, yes i understand that, I looked at the link...

    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...
  18. Thread: Vector Struct

    by Khadafi
    Replies
    28
    Views
    2,170

    Hi, i have never done anything like that before,...

    Hi, i have never done anything like that before, could you explain further, or like explain what the parts are doing

    thanks
  19. Thread: Vector Struct

    by Khadafi
    Replies
    28
    Views
    2,170

    Hi, dont worry about the last post i figured out...

    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...
  20. Thread: Vector Struct

    by Khadafi
    Replies
    28
    Views
    2,170

    thanks it does compile. I cant seem to print...

    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";
    }
  21. Thread: Vector Struct

    by Khadafi
    Replies
    28
    Views
    2,170

    the data types can be integers. the sort speed...

    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...
  22. Thread: Vector Struct

    by Khadafi
    Replies
    28
    Views
    2,170

    thanks for the prompt response. basically its to...

    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...
  23. Thread: Vector Struct

    by Khadafi
    Replies
    28
    Views
    2,170

    Vector Struct

    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
  24. Hi, sorry I was working on code to make sure that...

    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...
  25. Hi, sorry I dont know about gotoxy() ? the...

    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...
Results 1 to 25 of 56
Page 1 of 3 1 2 3