Search:

Type: Posts; User: Axel

Page 1 of 14 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    31
    Views
    4,077

    yes i understand now............ ...

    yes i understand now............




    loc=temp->next->next; /* store B somewhere */

    temp->next->next=temp->next->next->next; /* A-C-NULL */
  2. Replies
    31
    Views
    4,077

    ACB loc=temp->next->next; /* store B...

    ACB

    loc=temp->next->next; /* store B somewhere */

    temp->next->next=temp->next->next->next; /* A-C-NULL */


    loc->next=temp->next; /* ACC */

    temp->next=loc; /* A->B->C->NULL */
  3. Replies
    31
    Views
    4,077

    but after loc->next = temp->next; is run do...

    but after loc->next = temp->next;
    is run do they *BOTH* contain C? or just loc->next ?
  4. Replies
    31
    Views
    4,077

    sorry i meant loc->next so when you do: ...

    sorry i meant loc->next

    so when you do:




    loc->next = temp->next;
  5. Replies
    31
    Views
    4,077

    loc is NULL because of the previous lline yes? ...

    loc is NULL because of the previous lline yes?

    temp->next->next = temp->next->next->next;

    as with loc->next it is also null.

    so i read the following line


    loc->next = temp->next;
  6. Replies
    13
    Views
    1,448

    yes, i've did that but figured that it's...

    yes, i've did that but figured that it's incredibly insufficient in the long run. What happens when you have 30 fields in your node?? your code would get huge..
  7. Replies
    31
    Views
    4,077

    or is this close to what it does? ...

    or is this close to what it does?

    http://img120.imageshack.us/img120/7555/drawing1fu5.jpg
  8. Replies
    31
    Views
    4,077

    we start off with loc =...

    we start off with




    loc = temp->next->next;



    A | C | B
  9. Replies
    31
    Views
    4,077

    i have another bit of the code which i dont...

    i have another bit of the code which i dont understand. It handles the case where there are 3 nodes. If i have a list containing ACB and it pass it 'C' it swaps B and C around to form ABC.


    ...
  10. Replies
    31
    Views
    4,077

    i think it makes sense. So you are saying after...

    i think it makes sense. So you are saying after this line:

    curr->next = (curr->next)->next


    A and B become split (independant of each other) and then then you just insert B after a

    like...
  11. Replies
    31
    Views
    4,077

    i have doubts about 2 nodes only. well,...

    i have doubts about 2 nodes only.


    well, loc->next = current;

    whatevers in current (i.e. B) put it after loc->next.

    since loc is at the position current->next

    it makes B NULL B
  12. Replies
    31
    Views
    4,077

    here's what i mean diagrammatically.. it might...

    here's what i mean diagrammatically.. it might help explain easier:

    http://img98.imageshack.us/img98/540/testzj4.jpg
  13. Replies
    31
    Views
    4,077

    hmm ok what about:

    hmm ok what about:
  14. Replies
    31
    Views
    4,077

    nope, thanks anyway i have it working already. i...

    nope, thanks anyway i have it working already. i was just trying to understand the code.
  15. Replies
    31
    Views
    4,077

    yes it does. ummm loc = current->next;...

    yes it does. ummm




    loc = current->next; // makes loc point to A
    current->next = current->next->next; // sets B->next to null so we have B NULL A
    loc->next = current; // we then get A NULL...
  16. Replies
    31
    Views
    4,077

    hmm.. and what does the last line current =...

    hmm.. and what does the last line

    current = loc; do ?
  17. Replies
    31
    Views
    4,077

    what if there are only 2 nodes?

    what if there are only 2 nodes?
  18. Replies
    31
    Views
    4,077

    another list question....

    i have the following code:



    testNode *temp = current;
    testNode *loc;

    loc = current->next;
    current->next = current->next->next;
    loc->next = current;
  19. Replies
    13
    Views
    1,448

    ahh it was one line but so difficult. Basically i...

    ahh it was one line but so difficult. Basically i was scanning the list comparing start and start next nodes and saving them to a new list called "current". After each pass i wasn't updating start so...
  20. Replies
    13
    Views
    1,448

    i'm trying to do it with bubblesort hence i have...

    i'm trying to do it with bubblesort hence i have an outer while and inner for loop.
  21. Replies
    13
    Views
    1,448

    and even so i want to scroll through the list by...

    and even so i want to scroll through the list by doing:

    current = current->next;

    but i also have to swap fields, once the swap is complete i get a reference to the swapped list. i also have to...
  22. Replies
    13
    Views
    1,448

    i have tried using bubble sort but it still...

    i have tried using bubble sort but it still doesn't seem to work. I know that my swap method works i simply pass the petNo i want swapped so if i want the first element in the list swapped i pass 0...
  23. Replies
    13
    Views
    1,448

    Hmm i don't get what you mean? i tried it anyway...

    Hmm i don't get what you mean? i tried it anyway and only 2 nodes are printed out. i think the problem is i want to scan the list (with the start pointer) but if i want to swap i also have to use...
  24. Replies
    13
    Views
    1,448

    help with sorting function :(

    I've created the following nodes in my list:





    addElement(&start, "B", 1);
    addElement(&start, "D", 2);
    addElement(&start, "A", 3);
    addElement(&start, "C", 4);
  25. Thread: fscanf help

    by Axel
    Replies
    13
    Views
    2,118

    nevermind. I got it i think :) afte the while i...

    nevermind. I got it i think :) afte the while i just checked if its end of the file or not and exited.
Results 1 to 25 of 340
Page 1 of 14 1 2 3 4