Comments (2)
Hey Jou-Ting,
Thanks for your inquiry. I checked that algorithm in our book but don't see any
problem of it. Let me explain how our algorithm works as follows:
I will use 'A', 'B', .., as the notations of tutors. Remember that in our
problem we have limitation that every tutor must stop tutoring for the day at
most two hours after starting. For your first example,
A 9- 9:30
A 9:30 - 10
A 10 - 10:30
A 10:30 - 11 (A must stop since he/she has tutored for two hours today.)
B 11 - 11:30
C 11 - 11:30
As a result, for the first example, you need three tutors.
For your second example,
A 9 - 9:30
B 9 - 9:30
A 9:30 - 10
B 9:30 - 10
A 10 - 10:30
B 10 - 10:30
A 10:30 - 11 (A must stop since he/she has tutored for two hours today.)
B 10:30 - 11 (B must stop since he/she has tutored for two hours today.)
C 11 - 11:30
D 11 - 11:30
C 12 - 12:30
C 12:30 - 1
As a result, you need four tutors. The strategy I used here is exactly greedy
method mentioned in the book (i.e., as soon as there is a request that cannot
be handled by the previously assigned tutors, we choose a new tutor.)
Feel free to ask questions if you have any problem.
Original comment by [email protected]
on 16 Sep 2013 at 7:12
from elements-of-programming-interviews.
Original comment by [email protected]
on 16 Sep 2013 at 11:11
- Changed state: Invalid
from elements-of-programming-interviews.
Related Issues (17)
- Broken Link for New Source Code HOT 5
- solution 3.6 error HOT 2
- solution 3.7 error HOT 3
- solution 4.1 error HOT 3
- Introduction algorithm is incorrect, also implementation is missing from HOT 8
- problem 3.7 bugs/suggestions... HOT 3
- problem 3.4 the recurrence equation HOT 1
- Patch for /trunk/Subseq_cover.cpp HOT 1
- Patch for /trunk/Rebuild_BST_postorder.cpp HOT 2
- Patch for /trunk/Sudoku_solve.cpp HOT 2
- Problem 8.10 resize problem HOT 1
- 10.2 Indirect Sort Output Error HOT 1
- Patch for /trunk/Remove_kth_last_list_template.cpp HOT 3
- stringToInt in problem 5.6 accepts invalid input "-" HOT 1
- Version 1.3.0, Problem 6.4 (1.) Description is there in the book, but algorithm is missing HOT 1
- Broken links HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elements-of-programming-interviews.