473,414 Members | 1,577 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,414 software developers and data experts.

linklist

1) Is there a way, to delete say "n"th node in a link list without
actually traversing?

2) Is there a way to find out the number of nodes in the list without
traversing?

Nov 14 '05 #1
8 1568

"senthil" <se*********************@wipro.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com..

Assuming we're talking of a 'standard' linked list.
1) Is there a way, to delete say "n"th node in a link list without
actually traversing?
No.
2) Is there a way to find out the number of nodes in the list without
traversing?


No.

Unless you have trouble with an implementation in C, and it's a 'C' issue
(instead of some library or the OS) this is off topic.
Nov 14 '05 #2
senthil wrote:
1) Is there a way, to delete say "n"th node in a link list without
actually traversing?
No, unless you happen to know it's the first, or perhaps last, item
in the list. Ask your programming tutor for details.

2) Is there a way to find out the number of nodes in the list without
traversing?


Yes. Again, ask your programming tutor for details.
Nov 14 '05 #3
"senthil" writes:
2) Is there a way to find out the number of nodes in the list without
traversing?


I'm sure you realize that you could tally items as you add and remove items
from the list?
Nov 14 '05 #4

infobahn wrote:
senthil wrote:
1) Is there a way, to delete say "n"th node in a link list without
actually traversing?


No, unless you happen to know it's the first, or perhaps last, item
in the list. Ask your programming tutor for details.

2) Is there a way to find out the number of nodes in the list without traversing?


Yes. Again, ask your programming tutor for details.


If my programming tutor knows it, i would not have asked for it in
this newsgroup, wasting u people's precious time.
Please let me know "How to find out the number of nodes in the list
without traversing ?", I ask again, because you said,"Yes."

Nov 14 '05 #5
"senthil" <se*********************@wipro.com> wrote:
infobahn wrote:
senthil wrote:
2) Is there a way to find out the number of nodes in the list
without traversing?


Yes. Again, ask your programming tutor for details.


If my programming tutor knows it, i would not have asked for it in
this newsgroup, wasting u people's precious time.
Please let me know "How to find out the number of nodes in the list
without traversing ?", I ask again, because you said,"Yes."


You do not get infobahn's point, I'm afraid. Let me state it more
clearly, then: Do Your Own Damn Homework.

Richard
Nov 14 '05 #6

"senthil" <se*********************@wipro.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...

infobahn wrote:
senthil wrote:
1) Is there a way, to delete say "n"th node in a link list without
actually traversing?


No, unless you happen to know it's the first, or perhaps last, item
in the list. Ask your programming tutor for details.

2) Is there a way to find out the number of nodes in the list without traversing?


Yes. Again, ask your programming tutor for details.


If my programming tutor knows it, i would not have asked for it in
this newsgroup, wasting u people's precious time.
Please let me know "How to find out the number of nodes in the list
without traversing ?", I ask again, because you said,"Yes."


If you just take a moment to put yourself in the computer's
shoes, the answer should become obvious.

-Mike
Nov 14 '05 #7
If my programming tutor knows it, i would not have asked for it in
this newsgroup, wasting u people's precious time.
Please let me know "How to find out the number of nodes in the list
without traversing ?", I ask again, because you said,"Yes."
The question was already answered. Take the time to read the responses.

Nov 14 '05 #8
On 2005-01-03, gooch <go******@comcast.net> wrote:
If my programming tutor knows it, i would not have asked for it in
this newsgroup, wasting u people's precious time.
Please let me know "How to find out the number of nodes in the list
without traversing ?", I ask again, because you said,"Yes."
The question was already answered. Take the time to read the responses.


I don't know of any way to do it without traversing the list, however, you
could actually keep count of inserted and deleted nodes. The count would
get out of whack if you have a bad algorithm for insertion, or deletion, and
end up with orphan nodes, but this would certainly suffice, infact, its
quite possible to keep a count in the head of the list and leave that
variable unused in the rest of the nodes, although thats wasteful
(sizeof(int) * # nodes - sizeof(int) wasteful to be exact.)

-- The Dragon
MHM 7x9, Hits you harder than a 2x4.
Nov 14 '05 #9

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

Similar topics

2
by: jova | last post by:
I'm stuck I have to convert an array to a linklist the array is initialized as public Organization{ Crew members = new Member etc....
7
by: vjay | last post by:
I want to just create a linklist.The program below goes into an endless loop.The srange behaviour is that i can exit from the program if i create only two nodes.After two goes into infinite loop. ...
6
by: jwvai316 | last post by:
I don't really know how to say it so I just say it a nested linklist. How do you make LinkLists inside LinkList? Can anyone help me for this? I think an example program will help me a lot. ...
0
by: prashant0903 | last post by:
how i 'll made the linklist program in java both included insertion & deletion in program
5
by: Asembereng | last post by:
Hi i want to do insertion sort, merge sort and quick sort on my linkList of ints.. do anyone have an idea how to do it?? these are the codes. And i also need to define a lifo fifo class.. ...
2
by: zubia | last post by:
hi how 2 deal with the rptr n lptr in doubly linklist
0
by: smoothkriminal1 | last post by:
the question is u read timetable of 40 students from file n den find da slot where all fourty students dnt hve clash...if any.... may b i ll be able to make clash logic but i m even just nt...
1
by: smoothkriminal1 | last post by:
Write a Code that will pick timetable of 40 students from file using linklist n than find a slot where all the students dont have any class. file can be of any format Student can maximum take 6...
2
Parul Bagadia
by: Parul Bagadia | last post by:
I have written a code for deleting certain value from linklist; it's not working; where as i have written one for deleting a no., after given no. which works fine! I even debugged it; but invain;...
2
by: dynamo | last post by:
this is a basic linklist,there seems to be a runtime error when i run the program(the main function) i suspect it has something to do with my del function but i see nothing wrong can you help.Thanx...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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...
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.