How to delete the node at the end (tail) of the Linked List ?

Discussion in 'C Programming' started by Sumika, Jul 15, 2005.

  1. Sumika

    Sumika Guest

    Hello,
    I'm a newbie here, so don't know much friends.
    I've problem deleting my node at the tail, so could you all help me to
    solve my error,I worked on it for quite sometime but it just can't work.

    Thanks

    The following is my code:

    private void btnDeleteRear_Click(object sender, System.EventArgs e)
    {
    for(Node h = head; h != null; h = h.Link )
    {
    if(h.Link == tail) // Linked List is not empty
    {
    //tail.Link = this.tbxNum.Text;
    //tail.Link = new Node (this .tbx1.Text, null);
    tail = null;

    }
    else //When Linked List is empty.
    {


    this.tbxNum.Text = tail.Link.ToString();
    //Make head point to this first node.
    }
    size--;
    this.lblNum.Text= size.ToString();
    this.Visualize(head);
    }
    Sumika, Jul 15, 2005
    #1
    1. Advertising

  2. Sumika

    Artie Gold Guest

    Sumika wrote:
    > Hello,
    > I'm a newbie here, so don't know much friends.


    And, alas, it seems you don't know where you are.

    > I've problem deleting my node at the tail, so could you all help me to
    > solve my error,I worked on it for quite sometime but it just can't work.
    >
    > Thanks
    >
    > The following is my code:
    >
    > private void btnDeleteRear_Click(object sender, System.EventArgs e)


    And, since this is not C code, you're in the wrong place.

    [What *is* this, anyway....]

    Please post in an *appropriate* forum.

    HTH,
    --ag

    --
    Artie Gold -- Austin, Texas
    http://it-matters.blogspot.com (new post 12/5)
    http://www.cafepress.com/goldsays
    Artie Gold, Jul 15, 2005
    #2
    1. Advertising

  3. Sumika wrote:
    > Hello,
    > I'm a newbie here, so don't know much friends.


    That may explain why no one told you that comp.lang.c is not the place
    for your question because ...

    > private void btnDeleteRear_Click(object sender, System.EventArgs e)


    This is obviously C++ (or some near relative) and not C.
    C++ questions belong in <news:comp.lang.c++>

    They may be able to help you. You can make it easier on them if you
    don't use so much white space in your code (if that's because you are
    using tabs, don't; there's no real excuse for that any more). Also be
    sure to check their FAQ before posting. In the past it was considered
    good manners to lurk for several weeks before posting. This allowed you
    to see what kinds of questions were asked and to see the postings of
    either the FAQs themselves or links to them. You can accomplish the
    same thing virtually by using groups.google.com to check past postings.
    This has the additional benefit of allowing you to search for the
    possibility that your questions have already been asked and answered.
    Martin Ambuhl, Jul 15, 2005
    #3
  4. Sumika wrote:
    > Hello,
    > I'm a newbie here, so don't know much friends.
    > I've problem deleting my node at the tail, so could you all help me to
    > solve my error,I worked on it for quite sometime but it just can't work.
    >
    > Thanks
    >
    > The following is my code:
    >
    > private void btnDeleteRear_Click(object sender, System.EventArgs


    try here:
    news:microsoft.public.dotnet.languages.csharp
    Tydr Schnubbis, Jul 15, 2005
    #4
  5. Sumika wrote on 15/07/05 :
    > I've problem deleting my node at the tail, so could you all help me to
    > solve my error,I worked on it for quite sometime but it just can't work.


    It's an algorithm issue. The answer is not language-dependent.

    --
    Emmanuel
    The C-FAQ: http://www.eskimo.com/~scs/C-faq/faq.html
    The C-library: http://www.dinkumware.com/refxc.html

    "There are 10 types of people in the world today;
    those that understand binary, and those that dont."
    Emmanuel Delahaye, Jul 15, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sangram
    Replies:
    16
    Views:
    1,963
  2. Raj
    Replies:
    13
    Views:
    1,586
  3. Replies:
    10
    Views:
    731
    =?iso-8859-1?q?Erik_Wikstr=F6m?=
    Apr 16, 2007
  4. Replies:
    10
    Views:
    1,022
    =?iso-8859-1?q?Erik_Wikstr=F6m?=
    Apr 16, 2007
  5. Terry Michaels

    Tail Call Optimization (Tail Recursion)

    Terry Michaels, Apr 18, 2011, in forum: Ruby
    Replies:
    16
    Views:
    303
    Robert Klemme
    Apr 20, 2011
Loading...

Share This Page