Skip to content

fixes #110 #148

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

Merged
merged 4 commits into from
Dec 14, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions en/Greedy Algorithms/Fractional Knapsack.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@ Given a set of items, each with weight and a value, determine the number of each

#### Time Complexity

O(log n) Worst Case
O(1) Best Case (If middle element of initial array is the target element)

#### Space Complexity

O(1) For iterative approach
O(1) For recursive approach *if tail call optimization is used*, O(log n) due to recursion call stack, otherwise
O(nlog n) Worst Case
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a space. Also only the case if you presort the items (which should definitely be mentioned!). Also note that it can be done in O(n) using medians.


#### Example

Expand Down