Menu

Lists Questions

MCQ
91.
Given the Node class implementation, select one of the following that correctly inserts a node at the tail of the list.

public class Node
{
	protected int data;
	protected Node prev;
	protected Node next;
	public Node(int data)
	{
		this.data = data;
		prev = null;
		next = null;
	}
	public Node(int data, Node prev, Node next)
	{
		this.data = data;
		this.prev = prev;
		this.next = next;
	}
	public int getData()
	{
		return data;
	}
	public void setData(int data)
	{
		this.data = data;
	}
	public Node getPrev()
	{
		return prev;
	}
	public void setPrev(Node prev)
	{
		this.prev = prev;
	}
	public Node getNext
	{
		return next;
	}
	public void setNext(Node next)
	{
		this.next = next;
	}
}
public class DLL
{
	protected Node head;
	protected Node tail;
	int length;
	public DLL()
	{
		head = new Node(Integer.MIN_VALUE,null,null);
		tail = new Node(Integer.MIN_VALUE,null,null);
		head.setNext(tail);
		length = 0;
	}
}
forum Discussion
MCQ
92.
How do you calculate the pointer difference in a memory efficient double linked list?
forum Discussion
MCQ
93.
What is the time complexity of inserting a node in a doubly linked list?
forum Discussion
MCQ
94.
How do you insert a node at the beginning of the list?
forum Discussion
MCQ
95.
Consider the following doubly linked list: head-1-2-3-4-5-tail. What will be the list after performing the given sequence of operations?

	Node temp = new Node(6,head,head.getNext());
	Node temp1 = new Node(0,tail.getPrev(),tail);
	head.setNext(temp);
	temp.getNext().setPrev(temp);
	tail.setPrev(temp1);
	temp1.getPrev().setNext(temp1);
forum Discussion
MCQ
96.
What is the functionality of the following piece of code?
forum Discussion
MCQ
97.
Consider the 2-level skip list. 
data-structure-questions-answers-skip-list-q2
How to access 38?
forum Discussion
MCQ
98.
Consider an implementation of unsorted singly linked list. Suppose it has its representation with a head pointer only.Given the representation, which of the following operation can be implemented in O(1) time?

      i)Insertion at the front of the linked list
     ii)Insertion at the end of the linked list
    iii) Deletion of the front node of the linked list
   iv)Deletion of the last node of the linked list
forum Discussion
MCQ
99.
In linked list each node contain minimum of two fields. One field is data field to store the data second field is?
forum Discussion
MCQ
100.
What would be the asymptotic time complexity to add an element in the linked list?
forum Discussion