Home /University Of Sargodha (UOS) /Data Structure and Algorithm

Data Structure and Algorithm BS/MPhil Information Technology/MS Information Technology 3 Semester/Term University Of Sargodha (UOS) 2023

Data Structure and Algorithm BS/MPhil Information Technology/MS Information Technology 3 Semester/Term University Of Sargodha (UOS) 2023 — page 1

Discussion

Ask a question about this paper, or help someone else with theirs. Answers are emailed to whoever asked.

Your email is only used to send you replies and occasional Ustadni updates. It is never shown publicly.

Log in to post under your name

No questions yet — be the first to ask.

More Data Structure and Algorithm papers

See all

Paper text

Subject: Information Technology

Time Allowed: 02:30 Hours

University of Sargodha

BS 3'd Term Examination 2023

Paper: Data Structure & Algorithms (CMPC-203)

Maximum Marks: 40

Note: Objectivepart is compulsory. Attempt any three questions from subjective part.

Objective Part

(Compulsory)

Write sher answers of the following in 2- lines chich on your answer sheet.

(2*8)

By using java syntax, define the structure of a node of a queue.

How many references are normally used to maintain a circular queue data structure?

Which of the following is a linear or a non-linear data structure? Doubly linked listiaph.com

What is prefix of A+B * C2

Y.

Vi.

vii.

viK.

What is POSTFIX of AS B SC, where $ is exponentiation operator?

Write the name of technique to combine two sorted lists into a single sorted list.

What is the total number of nodes in a strictly binary tree having five number of leaves?

What is the associativity of exponentiation operator?

Subjective Part

Q

Traverse the following graph using DFS and BFS algorithms in ascending numeric order (that is a node

with smaller numeric number should be processed first). Start with node A.

[4+4]

Q.3.

0/4.

Q.6.

Write down a function that accepts two sorted arrays as parameters and combines these arrays into third

array (which is initially empty) in sorted order. The combined array is displayed by main(.

Note: there is no need to create a class. Only write down the relevant function and a few statements

that call this function in main

a) Draw a binary search tree by inserting the following numbers from left to right.

[8]

[6]

14, 5, 7, 1, 6, 10, 11, 17, 19, 18

Also write the pre-order, in-order and post-order traversal of the above tree created.

i) Pre order traversal

il) In-order traversal

iii) Post order traversal.

b) The in-order traversal of binary tree is

d, b, e, a, f, c, g

[2]

Preforder traversal of binary tree is a, b, d, e, c, f, g. Write down the post-order traversal of binary

a) Write down the function for binary scarching an element from an array recursively.

b) Write down a function that accepts reference of the first node as a parameter and returns total count

in the singly linked list.

a) Convert the following infix expression to postfix expression using stack. The symbol S is used for

exponentiation operator.

A + (((B -

C) *(D -

E) +

F) /

G) S (H - J)

b) Write down a function to add all elements of the array recursively.

ustadni.Fat

12]

- LK-6446/15-06-23 -

Scanned with CamScanner

ustadni.com