0% found this document useful (0 votes)
4 views24 pages

PYQ Paper 1 (Data Structures Using C++ 2022)

This document is a question paper for a Data Structures course, detailing the structure and requirements for the examination. It includes instructions for candidates, a breakdown of sections A and B, and various questions related to data structures, algorithms, and programming tasks in C++. The paper covers topics such as binary trees, heaps, recursion, sorting algorithms, and data structure operations.

Uploaded by

lockedupbro1608
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
4 views24 pages

PYQ Paper 1 (Data Structures Using C++ 2022)

This document is a question paper for a Data Structures course, detailing the structure and requirements for the examination. It includes instructions for candidates, a breakdown of sections A and B, and various questions related to data structures, algorithms, and programming tasks in C++. The paper covers topics such as binary trees, heaps, recursion, sorting algorithms, and data structure operations.

Uploaded by

lockedupbro1608
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 24
\o [This question Paper contains & printed pages.] Your Roll NoO..ecreeserrerr? Sr. No. of Question Paper: 1263 F Unique Paper Code : 2342571201 Name of the Paper : Data Structures Name of the Course : B.Sc. (Programme) and B.A. (Programme) Year of Admission : 2019 & onwards Semester oll Duration : 3 Hours Maximum Marks : 90 Instructions for Candidates 1. Write your Roll No. on the top immediately on receipt of this question paper. 2. Section A is compulsory. 3. Attempt any four questions from Section B. 4. Parts of the question must be answered together. P.T.O. aie | 2 1263 SECTION A 1 @ perform the insertion sort on the array 821 show the steps after each iteration, Also 3}, . Us Te the number of comparisons. “port (4) (b) Explain the properties of a binary heap. How + 8 different from a binary search tree, “ ) (c) Differentiate between the following : (4) (i) Arrays and Linked list (ii) Queue and Priority queue (c) Consider a function f() to compute Fibonacci numbers as defined below : (4) £0 0 if n=0 1 if n=1 Fib(n) Fib(n-1)+Fib(n-2) if n>=2 How many times will f() be called when n=4? (4) Draw a binary search tree using the following key values; 16, 7, 23, 22, 14, 15 ° 1263 3 (c) What are the different operations that can be performed on a Dequeue, Explain using an example. (4) (f) What are height-balanced trees? Explain using suitable example. QG) (g) ‘Stacks play a role in the implementation of recursion’. Justify the statement using a suitable example. (3) SECTION B 2. Consider the following Binary Search Tree. (15) Show the status of the tree after each of the following operations : P.T.O. 4 1263 ; the tree after insert) ( Draw i ertion of Node with value ‘K’. (ii) Delete node with value «q from resultant tree. the (ii) Write the pr-order traversal of the Tesultant tree. (iv) Is the resultant tree a height-balanceq tree? Give justification for your answer, (v) Finally, delete the node with value ‘M’ from the resultant tree. (a) What is Binary Recursion? Write a program in C++ for computing Fibonacci numbers via Binary Recursion. (6) (b) Write a program in C++ for performing a push operation on a stack using linked list. (5) (c) Write a program in C++ to delete a given element from a doubly linked list. (a) Consider the following sequence of operations performed on an initially empty doubly “i list : 1263 5 InsertBeginningy 10), InsertBeginning(s), InsertEnd(7), InsertEnd(2), DeleteBeginning(), Deletenode(2) Show the contents of the list, links between the nodes, head and tail after each operation. (b) What is an abstract data type? Differentiate between Stack and Queue with the help of a suitable example. (4) (c) Illustrate the operation of counting-sort on the array A = {6,0,2,0,1,3,4,6,1,3,2} (5) 5. (a) What is the advantage of using a circular linked list? Explain different operations performed on a circular linked list. (6) (b) Give the asymptotic analysis for the Big-O notation (5) using a suitable example. P.T.O. 1263 6 (c) Write any two real-life applications each of stack and queue. (4) (a) For each of the following trees, specify whether it is a binary search tree or not. Give reasons for your answers. (6) 1263 7 (23) a2 (b) Consider the following sequence of operations performed on a stack of size 5. Show the contents of the stack after each operation. (5) push (10), push (5), Pop (), push (2), push (16), push (12) push (22) push (6) pop () (c) Write a C++ program to sum ‘n’ number of elements of an array using a recursive function. (4) P.T.O. ( 8 ‘4263 7. (a) What do you understand by the Recursion-tree . method for solving recurrences. Draw a Recursion n 2 tree for the recurrence T(0)=1(3) (22), (6) (b) Explain Master’s theorem for solving recurrences giving a suitable example. (5) (c) Write a C++ program to insert an element at the front of a singly linked list. (4) (1000) \\ fev [This question paper contains 8 printed pages J Your Roll Nove Sr. No. of Question Paper: 1411 F Unique Paper Code : 2342571201 Name of the Paper : Data Structures Name of the Course : B.Sc. (Programme) and B.A. (Programme) Year of Admission : 2019 & onwards Semester 2H Duration : 3 Hours Maximum Marks : 90 Instructions for Candidates 1. Write your Roll No. on the top immediately on receipt of this question paper. 2. Section A is compulsory. 3. Attempt any four questions from Section B. 4, Parts of the question must be answered together. P.T.O. yall SECTION A (a) How a binary heap is different from 4 ; . . Mary search tree. Explain with a suitable examp| ie. (4) (b) What is the difference between Big-o and Bi g- Theta notation? Explain. @ (c) When do we use Stack Data structure? Write program in C++ for ‘push’ operation in array implementation of stack. Also discuss the stack overflow condition. (4) (d) Write a program in C++ to compute the sum of first n natural numbers using recursion. (4) (e) Create a binary search tree using the following key values; 12, 8, 23, 9, 14, 15 I411 3 () Give the Breadth-First ‘Traversal of the binary "'e? given below: (4) (g) What are height-balanced trees? Explain with the help of a suitable example. (3) (h) Discuss the role of stacks in the implementation of recursion with the help of a suitable example. (3) SECTION B 2. Consider the following Binary Search Tree. (15) P.T.O, 1411 4 Og & G) © @ Show the status of the tree after each of the following operations : (i) Draw the tree after insertion of node with value ll. (ii) Delete node with value 10 from the resultant tree. (iii) Write the pr-order traversal of the resultant tree (iv) Is the resultant tree a height-balanced tree? Give justification for your answer. (v) Finally, delete the node with value 4 from the resultant tree. Y 1411 f 3 rite i 3. (a) Write a program in C++ to compute the factorial of a number with and without using recursion: (6) (b) Solve the recurrence r(n)=31( 4} em using 4 (5) Recursion-tree method. (c) Write a program in C++ to insert an element at the front of a singly linked list. (4) 4. (a) Consider the following sequence of operations performed on an initially empty Deque : InsertFront(10), InsertFront(5), EraseFront(), InsertBack(7), Front(), EraseBack() Show the contents of the deque and output after each operation. (6) P.T.O. 1411 6 3. (b) Write a program in C++ for computing Fibona ace) numbers via Binary Recursion (5 ) (c) Hlustrate the operation of counting array A = {5,0,2,0,1,3,4,5,1,3,3} sort on the (4) (a) Consider the functions given below, sort the functions in increasing order of asymptotic (big- O) complexity : (6) f,(n) = n° log n f,(n) = 10000000 n f,(n) = 1.000001" f,(n) = 2!000000n f,(n) = nvn f,(n) = n(n—1)/2 (b) Write a program in C++ for performing an enqueue ation. (5) operation for an array-based queue implement 1411 7 element (c) Write a program in C++ to search for an in a doubly linked list and delete it if found. (4) 6. (a) Explain how Master’s theorem can be used for solving recurrences giving suitable example. (6) (b) Compare and contrast priority queue and dequeue. Also, give one real-life application of priority queue. (5) a given array (4) (c) Write a program in C++ to reverse using recursion. 7. (a) What is a circular linked list? How a circular linked list is different from a doubly linked list. Discuss erformed on a circular linked (6) different operations p list. (b) Perform the insertion sort on the array {7,1,10,6,3}, show the steps after each iteration. Also, report the number of comparisons. (5) P.T.O, ae 1411 8 (c) Explain 4 any two Abstr: stract Da ata T YPes, (4) (1000) Ven question paper contains 8 printed pages. Your Roll No. Sr. No. of Question Paper: 1431 F Unique Paper Code : 2342571201 Name of the Paper : Data Structure Name of the Course : B.A. (Programme) Semester =i Duration : 3 Hours Maximum Marks : 90 Instructions for Candidates 1. Write your Roll No. on the top immediately on receipt of this question paper. 2. Section A is compulsory. 3. Answer any four questions from Section B. 4. All parts of Question must be attempted together. P.T.O. 1431 2 SECTION A (a) Explain Static and Dynamic data structure with the help of a suitable example. (4) (b) Write C++ code for basic operations on Stack using array. (4) (c) Differentiate between Binary tree and Binary heap. (4) (d) Mention advantages of using Tree data structure. (3) (f) What are Height-balanced trees? Explain with the help of a suitable example. (3) (g) Mention any three applications of Stack. (3) 1431 3 (h) Apply insertion sort on given array arr = {12, 4, 34, 6,8}. Mention the resultant array after the 2nd iteration. (3) (i) Differentiate between Queue and Priority Queue. G3) G) What will be the output after performing following operations on an empty stack Push(4), Push(5), Pop(), pop()Push(5), Push(6), Pop() pop() QB) SECTION B 2. Consider the following Binary Search Tree (BST). (1S) P.T.O. Show the status of BST after each of the following operations :— a jith (i) Draw updated tree after inserting a node wil value 2 in the BST. (ii) Delete node 11 from the updated BST. we : ~ the resultant (ili) Write post-order traversal of the res BST. 1431 5 (iv) Add a node with value 10 to the tree constructed in step (iii) and draw the final tree (v) Write BFS traversal of the Final tree. 3. (a) Differentiate between Array and Linked list with suitable example. (6) (b) Draw a binary tree whose in-order and preorder traversals are given below :— In-order: FBADCE Preorder: ABFCDE (S) (c) Write a program in C++ to perform insertion and deletion at the end of a singly linked list. (4) P.T.O. 1431 6 4. (a) Differentiate between Deque and Queue with the help of a suitable example. (6) (b) Explain Master’s theorem for solving recurrences with the help of a suitable example. (5) (c) Explain Stack overflow and Stack underflow condition. (4) 5. (a) Write a program in C++ to implement Queue using Array. (6) (b) List any two advantage and two disadvantage of using recursion (5) (c) Write a C++ program to find n Factorial using recursive function. (4) 1431 7 6. (a) Differentiate between (with example) : (6) (i) BSF and DFS Traversal (ii) BST and height-balanced tree (b) Write C++ code to implement doubly linked list and discuss basic operations to be performed on doubly linked list. (5) (c) Explain base case and recursive case in recursion with a suitable example. (4) (a) Illustrate and perform count sort on the array {4,7,2,0,7,5} (6) (b) How many iterations are required to sort an array {6,12,5,8,4,7} using insertion sort? (5) P.T.O. ~~ 1431 8 (c) Explain Big - analysis with an example (4) (1000)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy