
하나의 배열에 2개의 스택을 구현하기
·
자료구조 + 알고리즘
이번에는 다음 문제를 해결해보았다. 내가 해결한 모양새는 대충 이렇다. 실행부 말고, Stack을 구현한 클래스 내용만 살짝 올려본다. 1. 변수, 예외, 생성자 //변수 private int max; private int ptrA; private int ptrB; private int[] stk; //예외 public class EmptyStack3Exception extends RuntimeException { public void EmptyStack3Exception() {} } public class OverflowStack3Exception extends RuntimeException { public void OverflowStack3Exception() {} } //생성자 public Stac..