Which of the following statements is true about a linked list?
Which of the following is an advantage of a linked list over an array?
1 Crore+ students have signed up on EduRev. Have you? Download the App |
In a singly linked list, each node contains a data element and a pointer to the _______ node.
Which of the following statements about inserting a new node at the end of a linked list is true?
Which of the following statements about inserting a new node at the beginning of a linked list is true?
Which of the following operations can be performed efficiently on a linked list?
What will be the output of the following code?
#include <iostream>
using namespace std;
struct Node {
int data;
Node* next;
};
int main() {
Node* head = NULL;
Node* temp = new Node();
temp->data = 5;
temp->next = NULL;
head = temp;
cout << head->data << endl;
return 0;
}
What is the time complexity of inserting a node at the beginning of a linked list?
Which of the following operations requires traversing the entire linked list?
Which type of linked list allows traversal in both directions?
Which of the following statements about a circular linked list is true?
What is the time complexity of searching for an element in a linked list?
What is the output of the following code?
#include <iostream>
using namespace std;
struct Node {
int data;
Node* next;
};
void printList(Node* head) {
Node* current = head;
while (current != NULL) {
cout << current->data << " ";
current = current->next;
}
}
int main() {
Node* head = NULL;
Node* temp = new Node();
temp->data = 1;
temp->next = NULL;
head = temp;
temp = new Node();
temp->data = 2;
temp->next = NULL;
head->next = temp;
printList(head);
return 0;
}