mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-24 03:56:28 +00:00
fix(csharp): Modify method name to PascalCase, simplify new expression (#840)
* Modify method name to PascalCase(array and linked list) * Modify method name to PascalCase(backtracking) * Modify method name to PascalCase(computational complexity) * Modify method name to PascalCase(divide and conquer) * Modify method name to PascalCase(dynamic programming) * Modify method name to PascalCase(graph) * Modify method name to PascalCase(greedy) * Modify method name to PascalCase(hashing) * Modify method name to PascalCase(heap) * Modify method name to PascalCase(searching) * Modify method name to PascalCase(sorting) * Modify method name to PascalCase(stack and queue) * Modify method name to PascalCase(tree) * local check
This commit is contained in:
@@ -19,7 +19,7 @@ class Item {
|
||||
|
||||
public class fractional_knapsack {
|
||||
/* 分数背包:贪心 */
|
||||
public double fractionalKnapsack(int[] wgt, int[] val, int cap) {
|
||||
public double FractionalKnapsack(int[] wgt, int[] val, int cap) {
|
||||
// 创建物品列表,包含两个属性:重量、价值
|
||||
Item[] items = new Item[wgt.Length];
|
||||
for (int i = 0; i < wgt.Length; i++) {
|
||||
@@ -51,7 +51,7 @@ public class fractional_knapsack {
|
||||
int cap = 50;
|
||||
|
||||
// 贪心算法
|
||||
double res = fractionalKnapsack(wgt, val, cap);
|
||||
double res = FractionalKnapsack(wgt, val, cap);
|
||||
Console.WriteLine("不超过背包容量的最大物品价值为 " + res);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user