Sei sulla pagina 1di 1

The University of Lahore

Subject: Design & Analysis of Algorithms Assignment#: 01


Due Date / Time: Oct 10, 2019 Max Marks: 15+15

1. A hacker needs to break a key. Key consists of N binary digits. Following


information is available for key:
i. No hint is available to break the key.
ii. A part of key (X consecutive digits) are known
iii. A member of key generating team was black-mailed. He revealed that N/3
binary digits are ignored while matching given key value with original
value.
Write down small procedures that guarantee to break the key in all of above cases.
Moreover, in each of above cases you have to calculate the complexity of process in
terms of N.

2. A builder has three types of workers i. type A ii. type B iii. type C. Construction
starts with type-A workers until their part of job is finished, then type-B workers
take over and continue working until their half work is done. Later, type C workers
join and work parallel to type B workers. Finally, construction is finished by type
C workers.
Following assumptions hold to keep things simple:
i. Every workers performs same amount of duties.
ii. Difference of gender, age, race is irrelevant

One building requires overall N workers (including all three type workers) to finish
the job in D days. The builder has a project of building three same type of buildings.

i. Write an algorithm that guarantees that all three buildings are finished in
2D days.
ii. If a worker charges R rupees per day, calculate overall workers’ cost (as
per above case)
iii. If the builder makes 50% more money than he spends on workers, how
much money did he make.

Section B

Potrebbero piacerti anche