0% found this document useful (0 votes)
15 views1 page

Problem Set 4

This document outlines Problem Set 4 for the EE 234 course at the University of Engineering and Technology, focusing on data structures and algorithms. It includes four questions related to Quicksort implementation, a hostel assignment problem, textbook exercises, and expectation value calculations. The problem set is due on April 4, 2022, and is worth a total of 20 points.

Uploaded by

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

Problem Set 4

This document outlines Problem Set 4 for the EE 234 course at the University of Engineering and Technology, focusing on data structures and algorithms. It includes four questions related to Quicksort implementation, a hostel assignment problem, textbook exercises, and expectation value calculations. The problem set is due on April 4, 2022, and is worth a total of 20 points.

Uploaded by

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

University of Engineering and Technology

Department of Electrical Engineering


EE 234: Data Structures and Algorithms
Spring 2022

Problem Set 4 Points: 20 Date: March 28, 2022 Due: April 4, 2022

Lab
Question 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 points
This question concerns question 7-2 (Quicksort with equal element values). Please read the
question carefully.
(a) (2 points) Implement the PARTITION' function as described in part(b) of the question.
(b) (2 points) Implement RANDOMIZED-QUICKSORT' as described in part(c) of the question.

Question 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 points
At an unnamed university, there are k hostels and n students. You are in charge of assigning
hostels to the students. The problem is that there are m pairs of students do not like one
another one and have requested you to not assign them the same hostel. This is in general a
very hard problem to solve efficiently and belongs to a class of problems called NP-hard. After
many sleepless nights, you have devised a simple strategy: you will randomly (and independently)
assign students to hostels (completely ignoring their requests). Your task is to empirically find
out that on average what fraction of the constraints will be satisfied? You may assume that your
hostels do not have any upper limit on the number of students that can be housed.

Theory

Question 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 points
Textbook questions:
(a) (1 point) Exercise 7.2.3
(b) (1 point) Exercise 7.2-4
(c) (1 point) Exercise 7.2-5
(d) (3 points) Problem 7.2 parts (a), (d)

Question 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 points
This question concerns the hostel assignment problem that you did in the lab. Calculate the
expectation value of the constraints that you satisfy through your random assignment. How does
your calculation match with your empircal result?

You might also like