Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

writing an algorithm to implement the Reverse method

Status
Not open for further replies.

Gzk2010

Programmer
Aug 17, 2010
48
0
0
US
Can someone help me write an algorithm to implement the Reverse method. Please include any test cases you would write to prove that software works. I am a newbie.
public class SimpleLinkedList<T>
{
public INode<T> Nodes { get; private set; }
private INode<T> _lastNode;

public void Add(INode<T> node)
{
if (Nodes == null)
{
Nodes = node;
_lastNode = node;
return;
}

_lastNode.Next = node;
_lastNode = node;
}

public void Print()
{
var n = Nodes;
while (n != null)
{
Console.WriteLine(n.Value);
n = n.Next;
}
}

public void Reverse()
{

}
}


thanks in advance
 
we won't do you work for you. however we can help. however what you are trying to do look like it is already implemented in the BCL as List<T>.

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
sounds like a school assigment to me...

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
its not a school assignment, iam a dba who has been asked to start learning dba for my IT shop. They eventually want me to write some front end apps
 
I meant to say they want me to start learning c# when the MS SQL server AD and exchange server and running smoothly.
Thanks JMeckly!


'however we can help. however what you are trying to do look like it is already implemented in the BCL as List<T>. I will figure it out from there.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top