style: format code (#4212)

close #4204
This commit is contained in:
acbin
2023-06-09 18:52:05 +08:00
committed by GitHub
parent ad03086f54
commit 00282efd8b
521 changed files with 5233 additions and 7309 deletions

View File

@ -1,34 +1,34 @@
package com.thealgorithms.dynamicprogramming;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
public class KnapsackMemoizationTest {
KnapsackMemoization knapsackMemoization = new KnapsackMemoization();
@Test
void Test1() {
int[] weight = { 1, 3, 4, 5 };
int[] value = { 1, 4, 5, 7 };
int[] weight = {1, 3, 4, 5};
int[] value = {1, 4, 5, 7};
int capacity = 10;
assertEquals(13, knapsackMemoization.knapSack(capacity, weight, value, weight.length));
}
@Test
void Test2() {
int[] weight = { 95, 4, 60, 32, 23, 72, 80, 62, 65, 46 };
int[] value = { 55, 10, 47, 5, 4, 50, 8, 61, 85, 87 };
int[] weight = {95, 4, 60, 32, 23, 72, 80, 62, 65, 46};
int[] value = {55, 10, 47, 5, 4, 50, 8, 61, 85, 87};
int capacity = 269;
assertEquals(295, knapsackMemoization.knapSack(capacity, weight, value, weight.length));
}
@Test
void Test3() {
int[] weight = { 10, 20, 30 };
int[] value = { 60, 100, 120 };
int[] weight = {10, 20, 30};
int[] value = {60, 100, 120};
int capacity = 50;
assertEquals(220, knapsackMemoization.knapSack(capacity, weight, value, weight.length));
}
}