Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lecture 15: Book Allocation Problem #569

Open
ishansurdi opened this issue Dec 10, 2024 · 0 comments
Open

Lecture 15: Book Allocation Problem #569

ishansurdi opened this issue Dec 10, 2024 · 0 comments

Comments

@ishansurdi
Copy link

  1. Problem: When the current student's page sum exceeded mid, the code incorrectly added the book's pages to pagesum instead of starting a new student's allocation.
    Impact: Incorrect allocation logic caused feasibility checks to fail.
    Binary Search Midpoint Calculation:

  2. Problem: mid was calculated as sum + (end - sum) / 2, which used the wrong boundaries (sum instead of start).
    Impact: Binary search did not narrow down the range correctly.
    No Edge Case Handling (m > n):

  3. Problem: The code didn't check if the number of students (m) was greater than the number of books (n).
    Impact: Returned incorrect results when allocation was impossible.
    Incorrect Return Value:

  4. Problem: The function always returned -1 due to misplaced logic.
    Impact: Even valid allocations failed to return the correct result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant