Construct a doubly linked list using a single pointer in each node?



Construct a doubly linked list using a single pointer in each node?..

Answer / Aditya Kumar Batham

"Creating a doubly linked list with a single pointer for each node in C# involves defining a Node class and then creating the links. Here's an example:nn```csharpnpublic class Node {n public int data;n public Node next;n public Node prev;n}npublic static void AddNode(ref Node head, int data) {n Node newNode = new Node() {n data = data,n prev = null,n next = headn };n if (head != null) {n head.prev = newNode;n }n head = newNode;n}n```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Data Structures Interview Questions

Does treemap sort on key or value?

1 Answers  


How do I use quick sort?

1 Answers  


If you do not initialize an array what will happen?

1 Answers  


Can we give size to arraylist?

1 Answers  


Which sorting algorithm is best for small data?

1 Answers  


Which is the parent class of list<e> class?

1 Answers  


Explain what are the major data structures used in the rdbms?

1 Answers  


What is the Insertion Sort Code?.

1 Answers   DELL,


What is difference between hashmap and treemap?

1 Answers  


Describe the height term in a tree.

1 Answers  


What are binary search and fibonacci search?

1 Answers  


Explain stacks and queues in detail.

1 Answers  


Categories