Backtracking (되추적)말이 존나어려운데 쉽게 말하면어떤 노드의 유망성 점검후 유망하지않으면 그 노드의 부모 노드로 되돌아간다 예를들면 어떤길을 따라 쭉 가는데 길이 막혀있으면 마지막으로 만났던 갈림길로 되돌아가서 다른길로 가는거를 생각하면 되겠다.Stack을 이용 자세한글은 https://idea-sketch.tistory.com/29 이분의 글을 참조 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001..
import java.io.IOException;import java.util.*; class Swap {int depth;int changeIndex; public Swap(int depth, int changeIndex) {this.depth = depth;this.changeIndex = changeIndex;} public int getDepth() {return depth;}public void setDepth(int depth) {this.depth = depth;}public int getChangeIndex() {return changeIndex;}public void setChangeIndex(int changeIndex) {this.changeIndex = changeIndex;} } ..