Return to Snippet

Revision: 32457
at September 25, 2010 10:04 by trentonknight


Updated Code
struct chainLink * buildLIST()
{
    chainLink *head[ARRAY_TOP];
    makeNULL(head);
    head[ARRAY_TOP] = new chainLink;
    return head[0];
}
void makeNULL(chainLink **newNode){

    for(int a = 0; a < ARRAY_TOP; a++){
        newNode[a] = new chainLink;
        newNode[a]->data = 0;
        newNode[a]->next = 0;
    }
}
struct chainLink * buildLIST()
{
    chainLink *head[ARRAY_TOP];
    makeNULL(head);
    head[ARRAY_TOP] = new chainLink;
    return head[0];
}
void Push(struct chainLink* headRef[ARRAY_TOP], int data){
    int key = 1;
    chainLink *head[ARRAY_TOP];
    makeNULL(head);

    head[0]->data = data;
    head[0]->next = headRef[0];
    headRef[0] = head[0];
}
void pushNODES(int index, int number){
    chainLink* head[ARRAY_TOP];
    makeNULL(head);
    head[index] =  buildLIST();
    Push(head, number);
}

Revision: 32456
at September 25, 2010 09:27 by trentonknight


Updated Code
struct chainLink * buildLIST()
{
    chainLink *head[ARRAY_TOP];
    makeNULL(head);
    head[ARRAY_TOP] = new chainLink;
    return head[0];
}
void makeNULL(chainLink **newNode){

    for(int a = 0; a < ARRAY_TOP; a++){
        newNode[a] = new chainLink;
        newNode[a]->data = 0;
        newNode[a]->next = 0;
    }
}
struct chainLink * buildLIST()
{
    chainLink *head[ARRAY_TOP];
    makeNULL(head);
    head[ARRAY_TOP] = new chainLink;
    return head[0];
}
void Push(struct chainLink* headRef[ARRAY_TOP], int data){
    int key = 1;
    chainLink *head[ARRAY_TOP];
    makeNULL(head);

    head[0]->data = data;
    head[0]->next = headRef[0];
    headRef[0] = head[0];
}
void pushNODES(){
    chainLink* head[ARRAY_TOP];
    makeNULL(head);
    head[0] =  buildLIST();
    Push(head,4);//push all numbers here

}

Revision: 32455
at September 25, 2010 09:19 by trentonknight


Updated Code
void makeNULL(chainLink **newNode){

    for(int a = 0; a < ARRAY_TOP; a++){
        newNode[a] = new chainLink;
        newNode[a]->data = 0;
        newNode[a]->next = 0;
    }
}
struct chainLink * buildLIST()
{
    chainLink *head[ARRAY_TOP];
    makeNULL(head);
    head[ARRAY_TOP] = new chainLink;
    return head[0];
}
void Push(struct chainLink* headRef[ARRAY_TOP], int data){
    int key = 1;
    chainLink *head[ARRAY_TOP];
    makeNULL(head);

    head[0]->data = data;
    head[0]->next = headRef[0];
    headRef[0] = head[0];
}
void pushNODES(){
    int getINT;
    chainLink* head[ARRAY_TOP];
    makeNULL(head);
    head[0] =  buildLIST();
	
	cout << "Enter data in form of int" << endl;
	cin >> getINT;

    Push(head,getINT);//push all numbers here
	
}

Revision: 32454
at September 25, 2010 09:10 by trentonknight


Initial Code
struct chainLink * buildLIST(int* hashTable, int sizeOfHashTable, int randArrayOFDATA[])
{
    chainLink *head[ARRAY_TOP];
    chainLink *second[ARRAY_TOP];
    chainLink *third[ARRAY_TOP];
    makeNULL(head);
    makeNULL(second);
    head[ARRAY_TOP] = new chainLink;

    head[0]->data = 1;
    head[0] = head[0]->next;

    return head[0];
}
void makeNULL(chainLink **newNode){

    for(int a = 0; a < ARRAY_TOP; a++){
        newNode[a] = new chainLink;
        newNode[a]->data = 0;
        newNode[a]->next = 0;
    }
}
void Push(struct chainLink* headRef[ARRAY_TOP], int data){
    int key = 1;
    chainLink *head[ARRAY_TOP];
    makeNULL(head);

    head[0]->data = data;
    head[0]->next = headRef[0];
    headRef[0] = head[0];
}
void pushNODES(int number){
    chainLink* head[ARRAY_TOP];
    makeNULL(head);
    head[0] =  
    Push(head,4);//push all numbers here
}

Initial URL

                                

Initial Description

                                

Initial Title
Node Array Based Off of Nick Parlante\'s tutorial from Stanford University

Initial Tags
list, array

Initial Language
C++