Menu

Queues Questions

MCQ
51.
What is the time complexity to insert a node based on key in a priority queue?
forum Discussion
MCQ
52.
What is not a disadvantage of priority scheduling in operating systems?
forum Discussion
MCQ
53.
What are the advantages of priority queues?
forum Discussion
MCQ
54.
What is the time complexity to insert a node based on position in a priority queue?
forum Discussion
MCQ
55.
What is a dequeue?
forum Discussion
MCQ
56.
Select the function which performs insertion at the front end of the dequeue?

a)

public void function(Object item)
{
 Node temp = new Node(item,null);
 if(isEmpty())
 {
  temp.setNext(trail);
  head.setNext(temp);
 }
 else
 {
  Node cur = head.getNext();
  temp.setNext(cur);
  head.setNext(temp);
 }
 size++;
}

b)

public void function(Object item)
{
 Node temp = new Node(item,null);
 if(isEmpty())
 {
  temp.setNext(trail);
  head.setNext(trail);
 }
 else
 {
  Node cur = head.getNext();
  temp.setNext(cur);
  head.setNext(temp);
 }
 size++;
}

c)

public void function(Object item)
{
 Node temp = new Node(item,null);
 if(isEmpty())
 {
  Node cur = head.getNext();
  temp.setNext(cur);
  head.setNext(temp);
 }
 else
 {
  temp.setNext(trail);
  head.setNext(temp);
 }
 size++;
}

d) None of the mentioned
forum Discussion
MCQ
57.
What is the functionality of the following piece of code?

public void function(Object item)
{
	Node temp=new Node(item,trail);
	if(isEmpty())
	{
		head.setNext(temp);
		temp.setNext(trail);
	}
	else
	{
		Node cur=head.getNext();
		while(cur.getNext()!=trail)
		{
			cur=cur.getNext();
		}
		cur.setNext(temp);
	}
	size++;
}
forum Discussion
MCQ
58.
What are the applications of dequeue?
forum Discussion
MCQ
59.
Which of the following can be used to delete an element from the front end of the queue?
forum Discussion
MCQ
60.
What is the time complexity of deleting from the rear end of the dequeue implemented with a singly linked list?
forum Discussion