473,659 Members | 2,671 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_C lick(object sender, System.EventArg s e)
{
for(Node h = head; h != null; h = h.Link )
{
if(h.Link == tail) // Linked List is not empty
{
//tail.Link = this.tbxNum.Tex t;
//tail.Link = new Node (this .tbx1.Text, null);
tail = null;

}
else //When Linked List is empty.
{
this.tbxNum.Tex t = tail.Link.ToStr ing();
//Make head point to this first node.
}
size--;
this.lblNum.Tex t= size.ToString() ;
this.Visualize( head);
}

Nov 15 '05 #1
4 3922
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_C lick(object sender, System.EventArg s 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_C lick(object sender, System.EventArg s 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.c om 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_C lick(object sender, System.EventArg s


try here:
news:microsoft. public.dotnet.l anguages.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
5486
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 following: struct Node { int integer_value;
3
1689
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 malloc in the add()at the same time If I used new and delete its working fine Can any one tell me the reason
13
6556
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
11228
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
6559
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> #include "stdafx.h" using namespace std; class IntNode
5
535
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->6->7->3->5->6->10->1->23->17 Delete every 3rd node (m = 3) and return the last remaining node meaning... 4->6->3->5->10->1->17 4->3->5->1->17 3->5->17
4
1627
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 { protected: struct node { char* data; node* prev; node* post;
3
447
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 can allocate memory once and use it to create new node in list. -Thanks -Kane
4
4759
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: #include <iostream> using namespace std; class NumberList {
0
8330
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8850
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8746
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8523
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8626
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7355
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4334
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.