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

S

Sumika

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);
}
 
A

Artie Gold

Sumika said:
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
 
M

Martin Ambuhl

Sumika said:
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 <
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.
 
T

Tydr Schnubbis

Sumika said:
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
 
E

Emmanuel Delahaye

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."
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top