PLIZ HELP ME OUT WITH THIS COURSE WORK, THE LECTURER WANTS IT ON 
MONDAY 21 JAN

One:

Attached are two files llist.cpp and list.h.  You are to complete the 
code. 

NOTE: NO COPYING, FROM EACH OTHER, OR FORM THE NEXT.  IF ANYPART OF 
THE CODE IS COPIED EITHER MAKE A COMMENT OR DON USE IT.

 

The link below will help you complete the assignment

 

http://www.pixelate.co.za/issues/9/articles/ll/article.html

 

Two:

Sort element in the linked list above using two sorting algorithms


//int _tmain(int argc, _TCHAR* argv[])
//{
//      return 0;
//}

/****************************************************
*linked list
*
********************************************************/
#include "stdafx.h"
#include <iostream>
using namespace std;

#include "llist.h"

void PrintList(Node_Ptr Head);


/*****************      Main Function Starts Here ***********/
int     main() {

        Node_Ptr        Head;
        Node_Ptr        NewNode_Ptr;
        Node_Ptr        Curr_Ptr;
        Node_Ptr        Prev_Ptr;
        Element_Type    InValue;

        /*------------Create a linked list--------------------------*/


        cout << "Enter values for linked list, one per line." << endl
                << "Enter 999 to end list."     << endl;

        Head = new LinkNode;
        cin     >> Head->data_member;
        Curr_Ptr = Head;

        cin     >> InValue;

        while (InValue != 999)
        {
                NewNode_Ptr                     = new LinkNode;
                NewNode_Ptr->data_member        = InValue;
                Curr_Ptr->link_member   = NewNode_Ptr;
                Curr_Ptr                        = NewNode_Ptr;
                cin     >> InValue;
        } // end while

        Curr_Ptr->link_member = NULL;   // mark the     tail

        PrintList(Head);                // display the list

        /*------------Add a     node to the     linked list-----------
--------*/

        cout << "Enter a value for a new last node:     ";
        cin     >> InValue;

        /**************** ADD CODE HERE TO ADD A NODE TO THE
        END     OF THE LINKED LIST      *********************/


        cout << endl << "The list after the     addition follows:" << 
endl;
        PrintList(Head);                // display the list

        /*------------Insert a node     in linked list----------------
---*/

        cout << "Enter the value of     node to insert in the list:
        ";
        cin     >> InValue;

        NewNode_Ptr                     = new LinkNode;
        NewNode_Ptr->data_member = InValue;

        Prev_Ptr = NULL;
        Curr_Ptr = Head;

        while ( (Curr_Ptr != NULL) && (InValue > Curr_Ptr-
>data_member)   )
        {
                Prev_Ptr = Curr_Ptr;
                Curr_Ptr = Curr_Ptr->link_member;
        }

        if (Prev_Ptr == NULL)
                Head = NewNode_Ptr;
        else
                Prev_Ptr->link_member = NewNode_Ptr;


        NewNode_Ptr->link_member = Curr_Ptr;

        cout << endl << "The list after the     insertion follows:"
        << endl;
        PrintList(Head);                // display the list



        /*------------Delete a node     from linked     list----------
---------*/

        Node_Ptr        Del_Ptr;

        cout << "Enter the value of     a node to delete: ";
        cin     >> InValue;


        /************ ADD CODE HERE     TO DELETE A     NODE 
***************/


        delete Del_Ptr;

        cout << endl << "The list after the     deletion follows:" << 
endl;
        PrintList(Head);                // display the list

} // end main
/***********************************************************/


/*---------------------------------------------------------
*  Function     Name: PrintList
*  Parameters:    pointer to the head of a linked list
*  Returns:       nothing
-----------------------------------------------------------*/
void PrintList(Node_Ptr Head) {

        Node_Ptr Curr_Ptr;
        Curr_Ptr = Head;        // this sets up a pointer to the Head

        cout << endl << "The list contains the following values." << 
endl;

        /**********      ADD A LOOP     HERE TO PRINT OUT THE VALUES 
*******/


} // end PrintList
P

typedef int Element_Type;

struct LinkNode;
typedef LinkNode* Node_Ptr;

struct LinkNode
{
    Element_Type data_member;
    Node_Ptr    link_member;
};






>-----------------------------------------~-~>
CHECK THE ARCHIVE BEFORE POSTING!!!! Archive is available at 
http://www.eScribe.com/software/C-Paradise/

>------------------------------------------_->


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/C-Paradise/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to