0% found this document useful (0 votes)
15 views5 pages

ITPC12 ES 2019 May

Uploaded by

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

ITPC12 ES 2019 May

Uploaded by

darkpheonix1245
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

ROLi 1'0.

NATIQNAL INSTITUTE OF TECHNOLOGY, KURUKSHETRA


THEORY EXAMINATION

Date of the Examination: 13-05-2019


Semester...2nd ...............................
Course No......ITPC-12..................
Numberof Questions to be attempted..05 Total No. of
Questions......06................

Programme:....B.Tech......... Subject: Data Structures Maximum Marks...50.........


Time allowed...3 Hours.........
Total No. of Pages used...03... .

The candidales, before starling to write the solution, should please d1eck the
question paper forany discrepancy, and also ensure that they have been delivered
the question paper of right course no. and subject title. Assume suitably and
state, additional data required, if any.

Note: Attempt any five questions and marks for every part of question are indicated
against of it.

r Q1.
I

Q2.
a.
An a-;:-ray of 10 clements, a[0:9], having values [4, 2, 6, 7,1, 0,r3+4
9, 8, 5, 3] is to be sorted using insertion sort
i. Draw a figure to show the progress of the sorting, for the above sequence of
input values.
n. Assume that a read vperation takes 1 unit of time, while a vaite operation takes
2 units of lime. What is the amount of time taken to complete the sorting? Explain
your reasoning used to compute the time taken. Also, explicitly mention any other
assumptions that you may need.
b. WAP in C language to find the last occurrence of a word in a 3
en strin &
a. Consider the following arithmetic expression P, written in 4
Postfix notation. Translate P, into its equivalent Infix Expression; evaluate the
infix expression using algorithm.
P:12,7,3,-,/,2,1,5, ,*,+

b. A stack of IN'l is implemented using an array as the following 2


data type:
#define SIZE 20 typedefstruct
{
int data[SIZEl; int top;
l Stack;
Fill up the missing codes in th<' PUSH, POP, and TOP 1
<peration.., of the Stack.

ROLL 'O.

NATIQNAL INSTITUTE OF TECHNOLOGY, KURUKSHETRA


THEORY EXAMINATION

Date of the Examination: 13-05-2019 Semester... 2nd �.����.�������������.�����.���.


Course No......ITPC-12..................
umber of Questions to be attempted..05 Total No. of
Questions......06................

Programme:....B.Tcch......... Subject: Data Structures Maximum Marks... 50.........


Time allowed...3 Hours.........
Total No. of Pages used...03... .

The candidates, before starling to write Lhe solution, should please check the
question paper for any discrepancy, and also ensure that they have been delivered
the question paper of right course no. and subject title. Assume suitably and
state, additional data required, if any.

Note: Attempt any five questions and marks for every part of question are indicated
against of it.

a. An array of 10 clements, aj0:9], having values [4, 2, 6, 7, 1, 0,


9, 8, 5, 3] is to be sorted using insertion sort
1. Draw a figure to show the progress of the sorting, for the above sequence of
input values.
11. Assume that ci rt::ad uperation takes 1 unit of time, while a write operation
takes 2 units of Lime. What is the amount of time taken to complete the sorting?
Explain your reasoning used to compute the time taken. Also, explicitly mention any
other assumptions that you may need.
b. WAP in C language to find the last occurrence of a word in a
&vcnstrin_&_
a. Consider the following arithmetic expression P, written in Postfix notation. 1
rarn,late P, into its equivalent Infix Expression; evaluate the infix expression
using algorithm.
P:12,7,3,-,/,2,1,5,+,*,+
b. A stack of I Tis implemented using an array as the following data type:
if define SIZJ� 20 typcdefstruct
{
int data[SIZEl; int top;
I Stack;
Fill up the missing codes m lhP PUSH, POP, and T
eiations oftheStack. _

3+4
3

_I

r
c. Writli an c1lgorithm to find hcther a

clement iI 4l-

I
I
Q3.

present or not in circular l]Ul'Ul'. What b the adv,1ntagl' ofl circular queue
Ovl'r a simpk� qucul�? I

a. \Vhat is the output of the following program? Explain it


,qjnclude<stdio.h> 2
void f(int �p, int ,..q)
I

p- q;
*p. 2;
l
int i = 0, j = 1;
int main()
{
f(&i, &j);
printf("11/4,d %d n", i, j);
getchar(); return O;
I I
b Assume that float takes 4 bytes, predict the output of following
I p"rogram and Pxplam it. 2
l I
float arr[S]:::{12.5, 10.0, 13.5, 90.5, 0.5};
float �ptrJ = &arr(0]; float ""ptr2 = ptrl + 3;
printf("%f ", "ptr2);
printf('"1od", ptr2- ptrl);

return O;

c. The clements 32, 15, 20,10, 12, 2c;, 16, 8. 10, 31 are inserted orwl
by one in the given order into a Max I feap. What will be the resultant Max
Heap and the number ofexchanges and also write
own the a!gorithm for Heapi_ry O and Build IJ..e ()?
a. WAl>inCprogram function to reverse every group ofk nodes
in a given double linked Ji-;t.
h. WAP in C' program to add two polynomial using:
1. DL�grel' based representation

5
2.5+2.5 I

_ ii._ E l:! cocf based repn:2._c -

I QS.
I
I

a. .a 4 I ;7 [

�: Ikl

uency

le: 5
I
I Q6.

/ ,
b.
Sho\,v the binary search tree that is obtained from after 5
in l'rtmg thL' key 8,11,.5,7,9,6,10,14,12. Red raw thetree after
dclL'tin_gthe root_.
a. Construct the Binary Tree using following Tree Traversal
c1lgorithms: 3
J n-order: 9, 8, 4, 2, 10, 5, 10, J, 6, 3, 13,12,7
Pre-order:], 2, 4, 8, 9, 5, 10, 10, 3, 6, 7, 12,13
b. WAP in C language to convert the conlt�nt of File to Uppercase. 3

_c. WA '2._C language to find the size of a BinaEl' free-. --- _4_ ,

You might also like