Save as PDF

Opens your browser print dialog — select "Save as PDF" to download.

Total No. of Questions : 8 Total No. of Printed Pages : 6 [2]
Roll No. ........................

CB-203 (GS)

B.Tech., (Computer Science and Business System)

II Semester

Examination, December 2023

Grading System (GS)

Data Structures & Algorithms

Time : Three Hours Maximum Marks : 70

Note: i) Answer any five questions.

किन्हीं पाँच प्रश्नों को हल कीजिए।

ii) All questions carry equal marks.

सभी प्रश्नों के समान अंक हैं।

iii) In case of any doubt or dispute the English version question should be treated as final.

किसी भी प्रकार के संदेह अथवा विवाद की स्थिति में अंग्रेजी भाषा के प्रश्न को अंतिम माना जायेगा।

1. a)

Write a function in C to display numbers which are appearing twice in a single dimensional array A of n integers. The function prototype for displaying the number which are appearing twice is as below:

int Frequency(int A[], int n);

n पूर्णांकों के एकल आयामी सरणी A में दो बार प्रदर्शित होने वाली संख्याओं को प्रदर्शित करने के लिए C में एक फंक्शन लिखो। दो बार दिखाई देने वाली संख्या को प्रदर्शित करने के लिए फंक्शन प्रोटोोटाइप नीचे दिया गया है।

int Frequency(int A[], int n);

b)

Compute the address of the element, A[11][13], of a two-dimensional array, X[2..50][3..100]. Assuming that the elements of the array are stored in column major order with base address 500.

द्वि-आयामी सरणी, X[2..50][3..100] के तत्व, A[11][13] के पते की गणना करें। यह मानते हुए कि सरणी के तत्व आधार पते 500 के साथ स्तंभ प्रमुख क्रम में संग्रहीत हैं।

2. a)

Write a function in C to create a singly linked list containing common elements in given two singly linked lists pointed by pointer S1 and pointer S2. The function prototype to create a singly linked list containing common elements is as below:

Node* Common(Node* S1, Node* S2);

Where, pointer S1 points to first linked list and pointer S2 points to second linked list.

Structure of the Linked List Node:

structList Node
{
int info;
structList Node* Next;
};
typedefstructList Node Node;

पॉइंटर S1 और पॉइंटर S2 द्वारा इंगित दो सिंगल लिंक्ड सूचियों में सामान्य तत्वों वाली सिंगल लिंक्ड लिस्ट बनाने के लिए C में एक फंक्शन लिखें। सामान्य तत्वों वाली एकल लिंक्ड सूची बनान�� के लिए फंक्शन प्रोटोोटाइप नीचे दिया गया है।

Node* Common(Node* S1, Node* S2);

b)

What are the advantages of linked list? When doubly linked list can be represented as circular linked list?

लिंक्ड लिस्ट के क्या फायदे है? डबल लिंक्ड लिस्ट को सर्कुलर लिंक्ड लिस्ट के रूप में कब प्रदर्शित किया जा सकता है?

3. a)

Convert the following infix expression into postfix expression using STACK. Show status of the STACK at each step.

K + L – M * N + W / U * T + Q

STACK का उपयोग करके निम्नलिखित इन्फिक्स एक्सप्रेशन को पोस्टफिक्स एक्सप्रेशन में बदलें। हर कदम पर STACK की स्थिति दिखाएँ।

K + L – M * N + W / U * T + Q

b)

Evaluate the following postfix expression and show status of stack at each step.

3693/* 8- *

निम्नलिखित पोस्टफिक्स एक्सप्रेशन का मूल्यांकन करें और प्रत्येक चरण पर STACK की स्थिति दिखाएँ।

3693/* 8- *

4. a)

Construct Binary Search Tree by inserting following values in sequence (Show BST construction steps). Also, write the preorder and postorder traversal of the above constructed Binary Search Tree.

55, 25, 89, 100, 20, 65, 22, 30, 60

अनुक्रम में निम्नलिखित मान सम्मिलित करके बाइनरी सर्च ट्री का निर्माण करें (BST निर्माण चरण दिखाएँ)। इसके अलावा, ऊपर निर्मित बाइनरी सर्च ट्री के प्रीऑर्डर और पोस्टऑर्डर ट्रैवर्सल को भी लिखें।

55, 25, 89, 100, 20, 65, 22, 30, 60

b)

Construct a min-heap tree by inserting following values in sequence. Show min-heap construction steps.

32, 48, 28, 79, 12, 8, 79, 66

निम्नलिखित मानों को अनुक्रम में सम्मिलित करते हुए एक मिन-हीप ट्री का निर्��ाण करें। मिन-हीप निर्माण चरण दिखाएँ।

32, 48, 28, 79, 12, 8, 79, 66

5. a)

Find the Minimum Spanning Tree (MST) for the following graph using Prim’s algorithm and compute the total weight of the spanning tree. Show the spanning tree construction steps.

प्रिम्स के एल्गोरिथम का उपयोग करके निम्नलिखित ग्राफ के लिए न्यूनतम स्पैनिंग ट्री (MST) खोजें और फैले हुए पेड़ के कुल वजन की गणना करें। फैले हुए पेड़ के निर्माण के चरण दिखाएँ।

Diagram for Question
6. a)

What is the difference between serial and direct file access organization?

सीरियल और डायरेक्ट फाइल एक्सेस ऑर्गनाइजेशन में क्या अंतर है?

b)

Give the advantage and disadvantage of indexed sequential access method.

इंडेक्सेड सिक्वेंशियल एक्सेस मेथड के लाभ और हानि बताइए।

7. a)

Find tight bound of running time of quadratic function.

f (n) = 3n^2 + 2n + 4

द्विघात फंक्शन के चलने के समय का टाइट बाउंड ज्ञात करें।

f (n) = 3n^2 + 2n + 4

b)

Show that:

दिखाइये कि

i) 3n + 2 = O(n)

ii) 6n^2 + n = Ω(n)

8. a)

Write a C program to perform searching operations using linear and binary search.

लीनियर और बाइनरी सर्च का उपयोग करके सर्च ऑपरेशन करने के लिए एक C प्रोग्राम लिखें।

b)

What is a data structure? Differentiate between linear and non-linear data structure?

डाटा संरचना क्या है? रैखिक और गैर-रैखिक डाटा संरचना के बीच अंतर करें।