Home

BS 4 Semester/Term 2024

BS 4 Semester/Term 2024 — 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.

Paper text

University of Sargodha

BS 4ª Term Exeminatien 2024

Sablest Comestse Scicase

Erast: Boice & Analesis ef Alterithm (CSCC-202)

Time Allowed: 02:30 Hours

Maximum Slarks: 60

Note: Objectine part is compubary. Attempt any farce gactivas from subjective part.

Q..

iv

Q.4.

0.5.

0.6.

Objective Part (Compelsory)

Wite short avers of the following in 23 lines of cath ca your answer shie.

(2*12)

What is a loop invariant?

Define average case complexio

Orher than speed, what other tenuren of effency migh one use in a real world seting?

What is an in place algorition?

Give

• recurrence that desenbes its wont-case rurbing time for binary search

Does the array 20, 15,

18. 7, 9.5,

12. 3,6/2 form a max beep?

Can heapsort be wed is the salary sorting todine in radix sort, because it operutes in place?

What is a pseudograph?

How many vertices are there in sC. graph

What are advantages of adjacency los

repecsestatico over incidence matrix?

What is an insertion cust for insertion into a max beap?

Subjective Part

(3-12)

Give in algorithen for locating the lust occutence of the largest number in a list of integers.

Estimate the number of compurisces und

Suppose that an array coetains nutbers, each of which is -1, 0 or -1. Write an algorithm to sort

the array in Ca).

Given a directod acyclic gruph, design an efficient algorithen to determine whether there is a path

between two given vertices of the graph? Derive complexity of the algorithm.

Given a directed acyclic graph, design an efficient algorithm to determine whether there is a

positive weight cycle in the graph? Derive complexity of the algoritem.

Design an efficient algorithm so find single-source longest paths in a dirocted acyclic graph. Also

denve its complexily