473,405 Members | 2,141 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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

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

Nov 15 '05 #1
4 3909
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
Nov 15 '05 #2
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.
Nov 15 '05 #3
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
Nov 15 '05 #4
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."

Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Fabio | last post by:
Hi everyone, Is there anybody who can suggest me a link where I can find information about 'Persistent linked list' ? I need to implement a linked list where every node is a structure like the...
3
by: MJ | last post by:
Hi I have created a prog for link list I am addig a node, displaying the LL contents, reversing the LL and deleting the LL In the delete() if I use free I am getting memory exception I have used...
13
by: Raj | last post by:
Is there any way to delete a particular node from a singly linked list where the header of the list is unknown.Only pointer available is the one which points to the node to be deleted
16
by: sangram | last post by:
how to delete last node of a Linked list if you only know the address of last node. thanks sangram
1
by: ahoway | last post by:
I am having problems deleting a node from a link list. I need to delete the node which contains the number six. This is what I have so far..... Thank you in advance. #include <iostream>...
5
by: Aditya | last post by:
This is a normal interview question, which goes like this "Given a linked list of integers, delete every mth node and return the last remaining node." eg: Linked list =...
4
by: Jonas Ferreira | last post by:
Hi everyone, I'm trying to code a linked list example and everything was working fine. Then I started to code my clear() (to clear my list) but it won't work. Here is the code: class list {...
3
by: Kane | last post by:
When you create node 1 you allocate memory and link it Again when you create node 2 you would allocate memory for that node in a different section of the code. Is there more efficient way where I...
4
by: moon24 | last post by:
Hi im working with linked list and i have to implement a function that deletes the duplicates of a number. for example if given 2 7 1 7 12 7 then the result should be 2 7 1 12 here is what I have:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.