lic static Node Duplicate(Node n)
{
// handle the degenerate case of an empty list
if (n == null) {
return null;
}
// create the head node, keeping it for later return
Node first = new Node();
first.Data = n.Data;
// the 'temp' pointer points to the current "last" node in the new list
Node temp = first;
n = n.Next;
while (n != null)
{
Node n2 = new Node();
n2.Data = n.Data;
// modify the Next pointer of the last node to point to the new last node
temp.Next = n2;
temp = n2;
n = n.Next;
}
return first;
}
Hi, This blog is the place who want to prepare for programming interview with major product development companies. Apart from interview questions I would like to provide some concepts on the new technologies which I learn as part of my carrier. Thanks for visiting my Blog.
Thursday, October 14, 2010
Subscribe to:
Post Comments (Atom)
AWS certification question
AWS AWS Hi! this is for questions related to AWS questions. EC2 instances EC2 storage types cold HDD : 1. Defines performance in terms...
-
Here I am going to discuss some of the differences between Text and String class in Hadoop. Text class lies in the package: import org.ap...
-
Q: What is the library you used in spring to connect to database? Spring JDBC template. Q: What and all involved in fetching the data ...
-
There are 2 ways we can load data into the HIVE Tables. In this tutorial we are loading data into the HIVE managed Table. This is my sa...
No comments:
Post a Comment