What's wrong with this code which returns xor of two nodes address?
//struct is common userdefined datatype in c/c++ and class is it's alternative
struct node* XOR (struct node *a, struct node *b)
{
//this logic is used to fill the nodes with address of a xor linked list
return ((int) (a) ^ (int) (b));
}
//struct is common userdefined datatype in c/c++ and class is it's alternative
struct node* XOR (struct node *a, struct node *b)
{
//this logic is used to fill the nodes with address of a xor linked list
return ((int) (a) ^ (int) (b));
}A. nothing wrong. everything is fine
B. type casting at return is missing
C. parameters are wrong
D. total logic is wrong
Answer: Option B
What is the time complexity of inserting an element at the beginning of a linked list?
A. O(1)
B. O(n)
C. O(log n)
D. O(n log n)
Which of the following is a disadvantage of linked lists compared to arrays?
A. Dynamic size
B. Random access
C. Ease of insertion and deletion
D. Memory overhead
What is a circular linked list?
A. A list where each node points to the next
B. A list where the last node points to the first node
C. A list where each node points to itself
D. A list where the nodes are in a circle
Which of the following is true about a doubly linked list?
A. Each node has one pointer
B. Each node has two pointers
C. It is a type of tree
D. It can be traversed in one direction only

Join The Discussion