Which of the following statements about a doubly linked list is true?
Which of the following statements about an array is true when compared to a linked list?
1 Crore+ students have signed up on EduRev. Have you? Download the App |
What is the output of the following code?
#include <iostream>
using namespace std;
struct Node {
int data;
Node* next;
};
void insertAtEnd(Node** head, int value) {
Node* newNode = new Node();
newNode->data = value;
newNode->next = NULL;
if (*head == NULL) {
*head = newNode;
} else {
Node* current = *head;
while (current->next != NULL) {
current = current->next;
}
current->next = newNode;
}
}
void printList(Node* head) {
Node* current = head;
while (current != NULL) {
cout << current->data << " ";
current = current->next;
}
}
int main() {
Node* head = NULL;
insertAtEnd(&head, 1);
insertAtEnd(&head, 2);
insertAtEnd(&head, 3);
printList(head);
return 0;
}
Which of the following operations can be performed efficiently on a linked list?
Which of the following operations can be performed on a linked list?
Which of the following is the correct way to traverse a linked list?
Which of the following algorithms can be used to reverse a linked list?
Which of the following is not a valid method to delete a node from a linked list?
Which of the following algorithms can be used to find the Nth node from the end of a linked list?
What is the time complexity to find the Nth node from the end of a linked list using the two-pointer approach?
153 videos|115 docs|24 tests
|
153 videos|115 docs|24 tests
|