AceTheInterview
Jobs in Pune | Work better in teams | Socialize with friends | Submit Q&A | Tell a friend
Search site for 

Top 100 Interview Questions & Answers in a convenient and easy to read book!

“I bought this guide a few days ago to prepare for my interview with Oracle. Many of the questions they asked me were from this guide. I found this book absolutely great!”

– Ravi, California

Read more comments...

Interview Questions And Answers RSS Feed

Answers »

  1. Submitted By: yeppikae — October 6, 2006
    +1 votes
      + -

    void sortedInsert(struct node** headRef, struct node* newNode){
    struct node** currentRef = headRef;
    while (*currentRef!=NULL && (*currentRef)->data < newNode->data){
    currentRef = &((*currentRef)->next);
    }
    newNode-> = (*currentRef)->next;
    *currentRef = newNode;
    }

  2. Submitted By: iamsuechoi — October 6, 2006
    not yet rated
      + -

    struct LinkedList
    {
    int nValue;
    LinkedList * pNext;
    };
    void InsertNewOneInSortedLinkedList(LinkedList *Head, LinkedList *NewOne)
    {
    LinkedList *One = NULL;
    LinkedList *PrevOne = NULL;

    if(Head->pNext == NULL)
    {
    Head->pNext = NewOne;
    NewOne->pNext = NULL;
    }

    One = PrevOne = Head;

    while(One->pNext)
    {
    if(One->nValue < NewOne->nValue)
    {
    PrevOne = One;
    One = PrevOne->pNext;
    }
    else
    break;
    }
    PrevOne->pNext = NewOne;
    NewOne->pNext = One;
    }

  3. Submitted By: iamsuechoi — October 6, 2006
    not yet rated
      + -

    struct LinkedList
    {
    int nValue;
    LinkedList * pNext;
    };

    void InsertNewOneInSortedLinkedList(LinkedList *Head, LinkedList *NewOne)
    {
    LinkedList *One = NULL;
    LinkedList *PrevOne = NULL;

    One = PrevOne = Head;

    while(One->pNext)
    {
    if(One->nValue < NewOne->nValue)
    {
    PrevOne = One;
    One = PrevOne->pNext;
    }
    else
    break;
    }
    PrevOne->pNext = NewOne;
    if(One->pNext == NULL) NewOne->pNext = NULL;
    else NewOne->pNext = One;
    }

  4. Submitted By: doshimun — October 6, 2006
    not yet rated
      + -

    // Definition of Node structure
    struct Node
    {
    int Data;
    Node * Next;
    };

    // Recursive function to insert in a sorted
    // list.
    // Note that the function returns the new
    // Head.
    // So the call looks like:
    // Head=InsertSorted(Head, 55);
    // Look at main function below
    Node * InsertSorted(Node * Start, int Num)
    {
    if (Start==0

  5. Submitted By: doshimun — October 6, 2006
    not yet rated
      + -

    // Definition of Node structure
    struct Node
    {
    int Data;
    Node * Next;
    };

    // Recursive function to insert in a sorted
    // list.
    // Note that the function returns the new
    // Head.
    // So the call looks like:
    // Head=InsertSorted(Head, 55);
    // Look at main function below
    Node * InsertSorted(Node * Start, int Num)
    {
    if (Start==0

  6. Submitted By: Piyush — October 6, 2006
    -1 votes
      + -

    Assuming linked list to be sorted in ascending order:
    This is the correct implementation “iamsuechoi”
    struct LinkedList
    {
    int nValue;
    LinkedList * pNext;
    };

    void InsertNewOneInSortedLinkedList(LinkedList *Head, LinkedList *NewOne)
    {
    LinkedList *One = NULL;
    LinkedList *PrevOne = NULL;

    One = PrevOne = Head;

    while(One != NULL)
    {
    if(One->nValue > NewOne->nValue)
    break
    else
    {
    PrevOne = One;
    One = One->pNext;
    }
    }
    PrevOne->pNext = NewOne;
    NewOne->pNext = One;
    }

  7. Leave an Answer/Comment

    To prove you're a person (not a spam script), type the security text shown in the picture. Click here to regenerate some new text.
    Click to hear an audio file of the anti-spam word

Our Sponsors
Our Sponsors
Contact Us | FAQ | Sitemap | Terms of Use | Privacy Policy | Tell a Friend

Copyright © 1999-2006 Jeeve Technologies LLC. All rights reserved.