1
In a doubly linked list the number of pointers affected for an insertion operation will be 4 0 1 Depends on the nodes of doubly linked list
2
I was trying to implement the Linked List code in C. It compiles fine but doesn't give any output. What seems to be the error? I think I messed up at passing pointer references as function parameters. My Code (Insert At Beginning): #include <stdio.h> ... to the head node(pointer to pointer) to the function. - Return the modified head node by the function. Please read about Reference Semantics.
3
Consider the C code fragment given below. typedef struct node { int data; node* next; } node; void join(node* m, node* n) { node* p = n; while(p->next != NULL) { p = p->next; } p->next = m; } Assuming that m and n point to valid NULL-terminated linked ... or append list m to the end of list n. cause a null pointer dereference for all inputs. append list n to the end of list m for all inputs.
4
struct node{ int num; struct node *next; } void print(struct node *ptr) { if(ptr) { printf("%d",ptr->data); do{ printf("%d",ptr->data); } while(ptr->next); } } What is the output, if a $SLL : 1\rightarrow 2\rightarrow 3\rightarrow 4\rightarrow 5$ is passed in the above $C$ code ? Assume Head pointer at Node $1$
5
1 vote
6
7
8
Time complexity to insert a node in the end of circular linked list, if the pointer to the 1st node is given and number of nodes in list is N is A)O(1) B)O(log N) C)O(N) D)O(N log N)
1 vote
9
In a doubly linked list organization, insertion of a record in end involves modification of ____ for existing list. one pointer two pointer multiple pointer no pointer
1 vote
10
The Answer given is A) I think the naswer should be B) as we have both the prev pointer and the next pointer available , it will take constant time to update the adjacent nodes pointers and delete the given node .?
11
Write a constant time algorithm to insert a node with data $D$ just before the node with address $p$ of a singly linked list.
12
Provide short answers to the following questions: Express the following list in terms of a linked list structure suitable for internal representation. $(((ab)c)d((e)))$
1 vote
13
14
15
A list of $n$ elements is commonly written as a sequence of $n$ elements enclosed in a pair of square brackets. For example. $[10, 20, 30]$ is a list of three elements and $[]$ is a nil list. Five functions are defined below: $car (l)$ returns the first element of its argument list $l$; $cdr (l)$ ... $f ([32, 16, 8], [9, 11, 12])$ (b) $g ([5, 1, 8, 9])$
16
In a circular linked list oraganisation, insertion of a record involves modification of One pointer. Two pointers. Multiple pointers. No pointer.
17
I am not getting how unsigned is used and how is it working???
18
Let P be a singly linked list. Let Q be the pointer to an intermediate node X in the list. What is the worst case time complexity of the best known algorithm to delete node X from the list? A) O(n) B) O(log 2 n) C) O(log n) D) O(1)
19
Consider the following incomplete C function for reversing a singly linked list. node* reverse(node* trav){ if(trav->next) __________________ else { head -> next = null; head = trav; } return trav; } Here, head is a global pointer pointing to the head of the list and where the head ... reverse(trav->next) -> next = trav; trav->next -> next = trav; trav -> next = trav; trav = reverse(trav->next);
20
Assume that you have a semaphore associated with each item on a doubly linked list. Using No other synchronization primitive, What is the fewest number of semaphore that you must acquire for any operation (lookup, insert, delete) ?
21
Two linked lists having n and m elements are stored in sorted order. What is the worst case complexity of program to print common elements of two lists ? \begin{align*} &A. \ \ O(n) \\ &B. \ \ \text{max}(m,n) \\ &C. \ \ \text{min}(m,n) \\ &D. \ \ m+n \end{align*}
22
Consider an implementation of unsorted single linked list. Suppose it has its representation with a head and a tail pointer (i.e. pointers to the first and last nodes of the linked list). Given the representation, which of the following operation can not be implemented in ... the end of the linked list. Deletion of the front node of the linked list. Deletion of the last node of the linked list.