Splitting a singly linked list for merge sort C++

Discussion in 'Software' started by soulhaunter, Apr 30, 2011.

  1. soulhaunter

    soulhaunter Private E-2

    Hi everyone

    I am trying to do a merge sort on a singly linked list with 10000 nodes in it. I am really new to this and it would be great to keep everything as basic as possible. Can anyone help me create a simple splitting method that can at least half a linked list over and over again?

    Here is my node class:
    Code:
    class Node
    {
    public:
    	int data;
    	Node* next;
    	Node()
    	{
    		next = NULL;
    		data = 0;
    	}
    	Node* Split();
    };
    and in my list class I have this within it:
    Code:
    	Node* head;
    	Node* current;
    	Node* tail;
     
  2. VeNzorrR

    VeNzorrR Private E-2

    Hmmm, sounds like second year advanced programming from the University of Hull, that right?
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds