This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import org.junit.*; | |
import static org.junit.Assert.*; | |
public class SetOfStacksTest { | |
@Test | |
public void testBasicPushAndPop(){ | |
SetOfStacks set = new SetOfStacks(); | |
set.push(1); | |
set.push(2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import org.junit.*; | |
import static org.junit.Assert.*; | |
public class SetOfStacksTest { | |
@Test | |
public void testSetOfStacks(){ | |
SetOfStacks set = new SetOfStacks(); | |
set.push(1); | |
set.push(2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import org.junit.*; | |
import static org.junit.Assert.*; | |
public class StackTest { | |
@Test | |
public void testStack(){ | |
Stack s = new Stack(); | |
s.push(1); | |
s.push(2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import org.junit.*; | |
import static org.junit.Assert.*; | |
public class TestAdjustableStacks { | |
@Test | |
public void testAdjustableStacks(){ | |
AdjustableStack stack = new AdjustableStack(); | |
try { | |
stack.push(0, 10); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import org.junit.*; | |
import static org.junit.Assert.*; | |
public class TestFixedStacks { | |
@Test | |
public void testFixedStacks(){ | |
FixedStacks stack = new FixedStacks(); | |
try { | |
stack.push(0, 0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import org.junit.*; | |
import static org.junit.Assert.*; | |
// First In First Out | |
public class TestQueue { | |
@Test | |
public void testQueue(){ | |
Queue<String> q = new Queue<String>(); | |
q.enqueue("0"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import org.junit.*; | |
import static org.junit.Assert.*; | |
// Last In First Out | |
public class TestStack { | |
@Test | |
public void testStack(){ | |
Stack<Integer> stack = new Stack<Integer>(); | |
stack.push(1); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import org.junit.*; | |
import static org.junit.Assert.*; | |
public class TestLinkedList { | |
@Test | |
public void testPalindromeDetector(){ | |
LinkedList<Integer> list = new LinkedList<Integer>(); | |
list.addFirst(1); | |
list.addFirst(2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import org.junit.*; | |
import static org.junit.Assert.*; | |
public class TestLinkedList { | |
@Test | |
public void testPalindromeDetector(){ | |
LinkedList<Integer> list = new LinkedList<Integer>(); | |
list.addFirst(1); | |
list.addFirst(2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import org.junit.*; | |
import static org.junit.Assert.*; | |
// 定義 | |
// 循環を含む連結リスト: 連結リストAではループを作るために、リスト内のノードの次へのポインタが以前に出現したノードを指している。 | |
// | |
// 例 | |
// 入力: A->B->C->D->E->C(最初のCと同じもの) | |
// 出力: C |