분류 전체보기
-
jupyter install on mac카테고리 없음 2017. 5. 28. 16:44
python3 을 사용하도록 한다. 1. pip 업데이트 $pip3 install --upgrade pip 2. jupyter 설치 $pip3 install jupyter 3. jupyter 시작 3.1 기본으로 시작$jupyter notebook -> 접속 : localhost:8888 3.2 포트 변경하여 시작 $jupyter notebook --port 9999-> 접속 : localhost:9999 3.3 브라우저 없이 실행 $jupyter notebook --no-browser
-
Java - 순열 ( Permutation )Tech/Algorithm 2017. 5. 28. 14:35
public static void main(String[] args) { System.out.println(getPermutations("324")); } /** * * 순열 구하기 */ public static List getPermutations(String s){ if(s==null) return null; //boolean 은 누구를 선택 했는지 판별 파라미터 return permuRec(s,new boolean[s.length()],"",new ArrayList()); } private static List permuRec(String s, boolean[] pick,String perm,ArrayList result){ //종료 조건 if(perm.length() == s.length()){ ..
-
Java - N 비트 경우의 수 출력Tech/Algorithm 2017. 5. 28. 14:24
public static void main(String[] args) { System.out.println(bitcomb(10)); } public static ArrayList bitcomb(int n){ return bitCombRec(n,"",new ArrayList()); } private static ArrayList bitCombRec(int n,String s,ArrayList list){ //s 가 n 비트이면 종료조건 if(n==s.length()) { list.add(s); return list; } bitCombRec(n,s+"0",list); bitCombRec(n,s+"1",list); return list; }
-
Java - WordCountTech/Algorithm 2017. 5. 28. 13:40
/** * 문서에서 특정 단어의 빈도수 구하기 * 문서는 단어별로 분리되어 String 배열로 입력 * 문서를 읽고 나면 여러 단어들의 빈도에 대해 자주 호출될수 있음 */ private HashMap map; public WordCount(){ map = new HashMap(); } public void read(String[] doc){ for(String word:doc){ //word 가 처음일 경우 if(!map.containsKey(word)) map.put(word,0); map.put(word,map.get(word)+1); } } public int getCount(String word){ //문서에 없는 단어일 경우 if(map.get(word) == null) return 0; re..
-
Java - 두 문자열이 Anagram 관계인가Tech/Algorithm 2017. 5. 28. 13:23
public static boolean isAnagram(String s1,String s2){ if(s1.length() != s2.length()) return false; HashMap hm = new HashMap(); //s1 for(char c:s1.toCharArray()){ // 이미 글자가 있을때 if(hm.containsKey(c)) hm.put(c,hm.get(c) + 1); else hm.put(c,1); } for(char c:s2.toCharArray()){ // 키가 없을 경우 -> s1 에는 포함되어있지만 s2에는 없다 라는것은 애너그램 관계가 아니다 if(!hm.containsKey(c)) return false; // 글자가 없을 경우 if(hm.get(c) == 0) r..