typedef struct list {
int data;
struct list *next;
} LIST;
Suppose a program has created two linked lists, L1 and L2. L1 contains 9 nodes with data values in order: 1, 7, 12, 3, 9, 5, 11, 15, 8. L2 contains 7 nodes with data values in order: 1, 11, 6, 9, 15, 12, 4.
Consider the following C program segment that modifies the list L1. The number of nodes that will be there in L1 after the execution of the code segment is ________. (Answer in integer)
int find (int query, LIST *list) {
while (list ≠ NULL){
if(list→data == query) return 1;
list = list→next;
}
return 0;
}
int main () {
ptr1=L1; ptr2=L2;
while (ptr1→next ≠ NULL){
query = ptr1→next→data;
if (find (query, L2))
ptr1→next = ptr1→next→next;
else ptr1 = ptr1→next;
}
return 0;
}Related Programming & Data Structures PYQs
Which of the following statement(s) is/are TRUE for any binary search tree (BST) having n distinct integers?
```c #include <stdio.h> void foo(int *p, int x){ *p=x; } int main(){ int *z; int a = 20, b = 25; z = &a; foo(z,b); pri…
The height of any rooted tree is defined as the maximum number of edges in the path from the root node to any leaf node. Suppose a…
```c #include <stdio.h> int foo(int S[],int size){ if(size == 0) return 0; if(size == 1) return 1; if(S[0] ≠ S[1]) return 1+…
```c #include <stdio.h> int gate (int n) { int d, t, newnum, turn; newnum = turn = 0; t=1; while (n≥t) t *= 10; t /=10; …
In a double hashing scheme, h1(k) = k mod 11 and h2(k) = 1 + (k mod 7) are the auxiliary hash functions. The size m of the hash ta…
Free account benefits
Turn practice into measurable progress
Public PYQs and reference pages stay free. Sign in when you want GATEverse to remember what you studied and guide what to practise next.