mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-06 00:54:32 +08:00
Moved StackPostfixNotation.java from the Others section to the Stack section (#4372)
* Moved StackPostfixNotation.java from the Others section to the Stack section * Put all stack related algo in a separate stack directory in the algorithms directory. The stack directory under data-structures now only contains various implementations of the stack data structure. * formatted files
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
package com.thealgorithms.datastructures.stacks;
|
||||
package com.thealgorithms.stacks;
|
||||
|
||||
import java.util.Stack;
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Program description - Given an integer array. The task is to find the maximum of the minimum of
|
||||
* the array
|
||||
*/
|
||||
package com.thealgorithms.datastructures.stacks;
|
||||
package com.thealgorithms.stacks;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.thealgorithms.datastructures.stacks;
|
||||
package com.thealgorithms.stacks;
|
||||
|
||||
import java.util.Stack;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.thealgorithms.datastructures.stacks;
|
||||
package com.thealgorithms.stacks;
|
||||
|
||||
// 1. You are given a string exp representing an expression.
|
||||
// 2. Assume that the expression is balanced i.e. the opening and closing brackets match with each
|
@ -1,4 +1,4 @@
|
||||
package com.thealgorithms.datastructures.stacks;
|
||||
package com.thealgorithms.stacks;
|
||||
|
||||
import java.util.Stack;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.thealgorithms.datastructures.stacks;
|
||||
package com.thealgorithms.stacks;
|
||||
|
||||
import java.util.Stack;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.thealgorithms.datastructures.stacks;
|
||||
package com.thealgorithms.stacks;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Stack;
|
@ -1,4 +1,4 @@
|
||||
package com.thealgorithms.datastructures.stacks;
|
||||
package com.thealgorithms.stacks;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Stack;
|
@ -1,4 +1,4 @@
|
||||
package com.thealgorithms.datastructures.stacks;
|
||||
package com.thealgorithms.stacks;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Stack;
|
@ -1,4 +1,4 @@
|
||||
package com.thealgorithms.datastructures.stacks;
|
||||
package com.thealgorithms.stacks;
|
||||
|
||||
import java.util.Stack;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.thealgorithms.others;
|
||||
package com.thealgorithms.stacks;
|
||||
|
||||
import java.util.Scanner;
|
||||
import java.util.Stack;
|
@ -1,8 +1,7 @@
|
||||
package com.thealgorithms.others;
|
||||
package com.thealgorithms.stacks;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import com.thealgorithms.datastructures.stacks.CalculateMaxOfMin;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class CalculateMaxOfMinTest {
|
||||
@ -11,48 +10,48 @@ public class CalculateMaxOfMinTest {
|
||||
void testForOneElement() {
|
||||
int[] a = {10, 20, 30, 50, 10, 70, 30};
|
||||
int k = CalculateMaxOfMin.calculateMaxOfMin(a);
|
||||
assertTrue(k == 70);
|
||||
assertEquals(70, k);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testForTwoElements() {
|
||||
int[] a = {5, 3, 2, 6, 3, 2, 6};
|
||||
int k = CalculateMaxOfMin.calculateMaxOfMin(a);
|
||||
assertTrue(k == 6);
|
||||
assertEquals(6, k);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testForThreeElements() {
|
||||
int[] a = {10, 10, 10, 10, 10, 10, 10};
|
||||
int k = CalculateMaxOfMin.calculateMaxOfMin(a);
|
||||
assertTrue(k == 10);
|
||||
assertEquals(10, k);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testForFourElements() {
|
||||
int[] a = {70, 60, 50, 40, 30, 20};
|
||||
int k = CalculateMaxOfMin.calculateMaxOfMin(a);
|
||||
assertTrue(k == 70);
|
||||
assertEquals(70, k);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testForFiveElements() {
|
||||
int[] a = {50};
|
||||
int k = CalculateMaxOfMin.calculateMaxOfMin(a);
|
||||
assertTrue(k == 50);
|
||||
assertEquals(50, k);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testForSixElements() {
|
||||
int[] a = {1, 4, 7, 9, 2, 4, 6};
|
||||
int k = CalculateMaxOfMin.calculateMaxOfMin(a);
|
||||
assertTrue(k == 9);
|
||||
assertEquals(9, k);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testForSevenElements() {
|
||||
int[] a = {-1, -5, -7, -9, -12, -14};
|
||||
int k = CalculateMaxOfMin.calculateMaxOfMin(a);
|
||||
assertTrue(k == -1);
|
||||
assertEquals(-1, k);
|
||||
}
|
||||
}
|
@ -1,8 +1,7 @@
|
||||
package com.thealgorithms.others;
|
||||
package com.thealgorithms.stacks;
|
||||
|
||||
import static java.util.Map.entry;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
import java.util.Map;
|
||||
import org.junit.jupiter.api.Test;
|
Reference in New Issue
Block a user