Re: Linked list

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Daniel O'Connell [C# MVP] (onyxkirx_at_--NOSPAM--comcast.net)
Date: 04/04/04


Date: Sun, 4 Apr 2004 14:25:14 -0500


"source" <sourcecode116@hotmail.com> wrote in message
news:ub851QnGEHA.3328@TK2MSFTNGP10.phx.gbl...
> This is not my homework. I read this question on one website, and I am
> preparing for an interview.
> Wanted to know where I can get good source for creating linked list.
> I tried looking up MSDN for examples that will implement ILIST interface,
> but did not find any examples.
> The only reference MSDN gives for using ILIST is for the Listbox control.
>
> Anyway thanks for the explanation for the test cases.
> But any good resource for ILIST examples will definately help.
for linked lists
http://www.codeproject.com/csharp/PhSinglyLinkedLists.asp?target=linked%7Clist

I don't have an example for IList, unfortunatly.

>
> Thanks
>
>
> "Mabden" <Mabden@sbcglobal.net> wrote in message
> news:EhTbc.45958$xY3.28138@newssvr25.news.prodigy.com...
>> "Daniel O'Connell [C# MVP]" <onyxkirx@--NOSPAM--comcast.net> wrote in
>> message news:eaE03tgGEHA.3288@TK2MSFTNGP12.phx.gbl...
>> >
>> > "source" <sourcecode116@hotmail.com> wrote in message
>> > news:uxTDOLgGEHA.3540@TK2MSFTNGP09.phx.gbl...
>> > >a function that would: return the 5th element from the end in a
> singly
>> > > linked list of integers, in one pass, and then provide a set of test
>> cases
>> > > against that function.
>> > > Can we do this in CSharp?
>> > > If no, then can anybody tell me how to go about coming with the
>> solution.
>> >
>> > Of course it can be done, except this sounds an awful lot like you are
>> > trying to get someone to do your homework.
>>
>> Traverse the list with one reference, and have another one that follows
>> along 5 elements back. When you reach the end of the list with the first
>> reference, the second one will be 5 from the end. You would need a
>> counter
>> to make sure you have at least 5 elements, of course.
>>
>>
>
>



Relevant Pages

  • Re: the garbage collector
    ... > Linked lists are still possible. ... Each node object would hold a reference ... If the garbage collector at some point decides ...
    (alt.comp.lang.borland-delphi)
  • Re: Interesting article by Joel Spolsky: The Perils of JavaSchools
    ... >>linked lists. ... I don't know if there is any authority for such a ... > A reasonably authoritative definition is given at ... I can image I'd have been jumped on, and I am not sure this reference ...
    (comp.programming)
  • Re: passing char arrays by reference
    ... There are other contexts in which "pointer" and ... pass by reference. ... you can implement linked lists by careful use of pointers. ... Linked lists, I'll grant you - but pass-by-reference in C? ...
    (comp.lang.c)
  • Re: passing char arrays by reference
    ... There are other contexts in which "pointer" and ... You can pass a reference in C, ... Similarly, C doesn't directly support linked lists, but you can ...
    (comp.lang.c)
  • Re: Linked list
    ... This is not my homework. ... preparing for an interview. ... The only reference MSDN gives for using ILIST is for the Listbox control. ...
    (microsoft.public.dotnet.languages.csharp)