Home /UOG — University of Gujrat /Data Structure and Algorithm

Data Structure and Algorithm UOG — University of Gujrat 2021

Data Structure and Algorithm UOG — University of Gujrat 2021 — 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.

Need Paper? See all →

Need a paper or stuck on a question? Ask here — students reply and you get an email.

Ask about a paper
  • Bushra· 20 hours ago

    BS Islamic Studies, 5th semester, ISL-511 Translation of Holy Quran (3) — Government College University Faisalabad (GCU…

    0 replies Reply →
  • Khadija· 2 days ago

    Civics course code GCCE101

    1 reply Reply →
  • Tasddaq hussain· 2 days ago

    BS 4the semester2025 civics and community engagement past paper According UOs

    0 replies Reply →
  • Humna Khan· 3 days ago

    Bs public administration 1st semester mid term past papers

    0 replies Reply →
  • Rania· 3 days ago

    BS English from uni of Sargodha Functional English, history of old English literature, literary devices and genres,

    0 replies Reply →
Ad

Paper text

UNIVERSITY OF GUJRAT

Final Term Examination-Fall 2021

Department of Computer Science

Course code: CS-209/ CS-203

Time Allowed: 2:30 hours

Course Title: Data Structures and Algorithm

Total Marks: 50

Name: _______________

Roll No: 22021519-079

Attempt all questions

1. Write a function to detect if two linked lists intersect, and if they do, find the intersection content

along with node number. [5]

2. Imagine an Emergency Room (ER) Patient Management System that handles patients based

on urgency and arrival time, using a combination of a stack and a queue. The stack is used to

manage critical patients who need immediate attention, following a Last In, First Out (LIFO)

approach. The most recently arrived critical patient is treated first. Meanwhile, the queue

handles normal patients on a First Come, First Served (FIFO) basis, ensuring they are attended

in the order they arrived.

When a new patient arrives, critical cases are pushed onto the stack, while normal cases are

enqueued into the queue. During treatment, the system prioritizes patients in the stack (critical)

over those in the queue. If the stack is empty, the next patient is taken from the queue. The

system also provides status updates, displaying the number of patients in the stack and queue

and notifying when no patients remain. This approach ensures a balance between managing

emergency cases efficiently and maintaining fairness for non-critical patients. [15]

3. Sort the given list of numbers using heap sort (dry run) and write down all steps to sort the

complete array. 8,6,4,10,11,1,13,2,9,5 [5]

4. Build an AVL tree with the following values

50, 30, 70, 20, 40, 60, 80, 10, 25, 35, 45, 55, 65, 75,

85. [10]

5. Use Dijakstra's algorithm to find the path with minimum cost among all nodes in the

following weighted graph. [5]

6. Consider hash table of size 10 and following items to be sorted. Use hash function discussed in

class to create key values of the following array.

10,8,28,33,93,90,42,54,75,50 [10]