edited by
923 views
1 votes
1 votes
p=head;
q=head-> next;
while(A)
{
     .......................................
}


A is the condition to see list is empty or not, which one is valid?

a) p!=NULL;

b) q!=NULL;

c)(p!=NULL)&&(q!=NULL)

d)(p!=NULL)||(q!=NULL)

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

a) p!=NULL;

b) q!=NULL;

c)(p!=NULL)&&(q!=NULL)

d)(p!=NULL)||(q!=NULL)

edited by

1 Answer

0 votes
0 votes
List is empty means there would not be any node in the list. Means the pointer "head" should point to Null.

'q' will be considered if there exist atleast a single node. So all other three option will be eliminated.(As question is talking about empty list.)

Option A is correct.

Related questions

0 votes
0 votes
1 answer
1
deepak_8404 asked Oct 1, 2023
280 views
Consider a lower triangular matrix stored in row major order as p[-25 - - + 749][-25 - - - + 749] with base address = 6800, size of each element = 6 byte. Find the value ...
–4 votes
–4 votes
2 answers
3
Souvik33 asked Oct 27, 2022
602 views
*MSQ*The following figure depicts a a. A tree and only treeb. A tree with 3 nodesc. A graph (Since every tree is a graph)d. A graph and only graph
0 votes
0 votes
1 answer
4
Overflow04 asked Sep 28, 2022
436 views
Can we determine unique tree by Inorder and level order traversal .