Jawaharlal Nehru Technological University Hyderabad
Jawaharlal Nehru Technological University Hyderabad B.Tech II Year DATA STRUCTURES Previous Question Paper (October - 2020 - R15)
Answer any five questions. All questions carry equal marks.
Main
Distinguish between circular linked list and doubly linked list by giving one example for each.
Answer
A Circular Linked List is a variation of a linked list where the last node points back to the first node instead of NULL, creating a continuous loop. This allows for traversal of the entire list starting from any node. An example is a round-robin task scheduler where processes are cycled through repeatedly.
A Doubly Linked List contains nodes where each node has two pointers: one to the next node and one to the previous node. This structure allows bidirectional traversal. An example is the 'Undo' functionality in a text editor, where navigating back and forth through states is required.
Write a C function for deleting an integer element from the singly linked list of integer elements. Assume that the singly linked list of integers is already created.
Answer
The following C function deletes the first occurrence of a specified integer from a singly linked list:
void deleteNode(struct Node** head, int key) {
struct Node *temp = *head, *prev;
if (temp != NULL && temp->data == key) {
*head = temp->next;
free(temp);
return;
}
while (temp != NULL && temp->data != key) {
prev = temp;
temp = temp->next;
}
if (temp == NULL) return;
prev->next = temp->next;
free(temp);
}The function handles three cases: deleting the head node, deleting a node in the middle or end, and handling cases where the element is not found.
Write a C function for inserting an integer element into a circular queue of integers. Assume array representation for the circular queue.
Answer
Sign in to view the complete answer paper.
Convert the following infix expression into postfix form
Answer
Sign in to view the complete answer paper.
Write a non recursive procedure for the inorder and post order traversal of a binary tree. Assume that the binary tree of elements is already created.
Answer
Sign in to view the complete answer paper.
Write heap sort algorithm for sorting a list of integers in ascending order.
Answer
Sign in to view the complete answer paper.
What is the time complexity of heap sort in the worst case?
Answer
Sign in to view the complete answer paper.
Compare the performance of AVL tree with binary search tree.
Answer
Sign in to view the complete answer paper.
Write the Knuth-Morris-Pratt pattern matching algorithm.
Answer
Sign in to view the complete answer paper.
Explain with an example any one method used for representing sparse matrix.
Answer
Sign in to view the complete answer paper.
Write a C function for concatenating two singly linked linear lists of characters. Assume that the two singly linked lists of characters are already created.
Answer
Sign in to view the complete answer paper.
Write a C program to implement stack using singly linked list.
Answer
Sign in to view the complete answer paper.
Explain with an example the adjacency matrix representation of a graph also mention its complexities.
Answer
Sign in to view the complete answer paper.
Write a recursive procedure for the DFS of a graph.
Answer
Sign in to view the complete answer paper.