edited by
4,407 views
1 votes
1 votes

Consider the following statements for priority queue:

S1: It is a data structure in which the intrinsic ordering of the elements does determine the result of its basic operations.

S2: The elements of a priority queue may be complex structures that are ordered on one or several fields

  1. Both S1 and S2 are incorrect
  2. S1 is correct and S2 is incorrect
  3. S1 is incorrect and S2 is correct
  4. Both S1 and S2 are correct
edited by

2 Answers

Best answer
3 votes
3 votes

Answer : Both S1 and S2 are correct.

statement S1 talks about the intrinsic ordering and it is true because in priority queue we do any operation a/c to the priority of elements.and result of the operation depends on this ordering.

a/c to statement S2 there is no bounding of what kind of element a priority queue should have they may also be complex or simply a list of elements, the only thing should be considered is the  priority of the elements.

selected by
1 votes
1 votes
I am not sure but I think option C is correct, because for example

min or max heap is the implementation of priority queue, in that order of elements may not decide result of basic operation so s1 is false

s2 is true because heap as priority queue implementation is complex
Answer:

Related questions

2 votes
2 votes
1 answer
1
shivani2010 asked Jun 15, 2016
1,914 views
The time complexity to build a heap with a list of n numbers isO(log n)O(n)O(n logn)O(n$^2$)
1 votes
1 votes
1 answer
2
go_editor asked Jul 14, 2016
2,228 views
The $mv$ command changesthe inodethe inode-numberthe directory entryboth the directory entry and the inode
3 votes
3 votes
1 answer
4
go_editor asked Jul 14, 2016
4,091 views
A virtual memory based memory management algorithm partially swaps out a process. This is an example ofshort term schedulinglong term schedulingmedium term schedulingmutu...