CS301 - Data Structure Finalterm Subjective Paper July 2012
Total 52 questions
4o mcqs
4 questions of 2 marks
4 questions of 3 marks
4 questions of 5 marks
Questions of 2 marks:
In the array representation of union what represents -1?
For smaller lists, linear insertion sort performs well, but for larger lists, quick sort is suitable to apply." Justify why?
If we want to delete the node from BST which has left and right child then which rotation is applied ?
Collision in hashing definition?
4o mcqs
4 questions of 2 marks
4 questions of 3 marks
4 questions of 5 marks
Questions of 2 marks:
In the array representation of union what represents -1?
For smaller lists, linear insertion sort performs well, but for larger lists, quick sort is suitable to apply." Justify why?
If we want to delete the node from BST which has left and right child then which rotation is applied ?
Collision in hashing definition?
Question of 3 marks:
Algorithm union by weight?
One tree is given question is it heap or not if it is heap then write its type?
Which data structure is best for priority queue?
Questions of 5 marks:
Some numbers are given and using those make BST?
One array is given we require to sort it using bubble sort and write only 2 iterations?
One tree is given which not the heap but after minimum changes it becomes max heap make it?
Algorithm union by weight?
One tree is given question is it heap or not if it is heap then write its type?
Which data structure is best for priority queue?
Questions of 5 marks:
Some numbers are given and using those make BST?
One array is given we require to sort it using bubble sort and write only 2 iterations?
One tree is given which not the heap but after minimum changes it becomes max heap make it?
Another Paper:
Question 1: Write min heap after removal of root. 3 marks.
1 3 2 5 4 8 9 10 7
Question 2: Write In order and preorder traversal. 3 marks
Question 3: show steps of merge sort. 5 marks.
11 12 13 21 22 23 31 33 41 42
Question 4: correct the following code.
int isPresent(int *arr, int val, int N)
{ int low = 0;
int high = N - 1;
int mid;
while ( low >= high )
{ mid = ( low-high )/2;
if (arr[mid] == val)
return 1; // found!
else if (arr[mid] > val)
low = mid - 1;
else
high = mid + 1;
}
return 0; // not found
}
Question 5: Correct the code.5 marks
/* The inorder routine for threaded binary tree */
TreeNode* nextInorder(TreeNode* p){
if(p->RTH == thread)
return(p->R);
else {
p = p->R;
while(p->LTH == child)
p = p->L;
return p;
}
}
Question 6:
for telephone directory which is best linear or non-linear array. 2 marks
Question 7:
how to cope with collision. 2 marks
Question 1: Write min heap after removal of root. 3 marks.
1 3 2 5 4 8 9 10 7
Question 2: Write In order and preorder traversal. 3 marks
Question 3: show steps of merge sort. 5 marks.
11 12 13 21 22 23 31 33 41 42
Question 4: correct the following code.
int isPresent(int *arr, int val, int N)
{ int low = 0;
int high = N - 1;
int mid;
while ( low >= high )
{ mid = ( low-high )/2;
if (arr[mid] == val)
return 1; // found!
else if (arr[mid] > val)
low = mid - 1;
else
high = mid + 1;
}
return 0; // not found
}
Question 5: Correct the code.5 marks
/* The inorder routine for threaded binary tree */
TreeNode* nextInorder(TreeNode* p){
if(p->RTH == thread)
return(p->R);
else {
p = p->R;
while(p->LTH == child)
p = p->L;
return p;
}
}
Question 6:
for telephone directory which is best linear or non-linear array. 2 marks
Question 7:
how to cope with collision. 2 marks