본문 바로가기
728x90
반응형

분류 전체보기176

recursion으로 미로찾기 미로찾기 package recursion; public class Maze { private static int N = 8; private static int[][] maze = { { 0, 0, 0, 0, 0, 0, 0, 1 }, { 0, 1, 1, 0, 1, 1, 0, 1 }, { 0, 0, 0, 1, 0, 0, 0, 1 }, { 0, 1, 0, 0, 1, 1, 0, 0 }, { 0, 1, 1, 1, 0, 0, 1, 1 }, { 0, 1, 0, 0, 0, 1, 0, 1 }, { 0, 0, 0, 1, 0, 0, 0, 1 }, { 0, 1, 1, 1, 0, 1, 0, 0 } }; private static final int PATHWAY_COLOR = 0; private static final int W.. 2020. 6. 23.
최댓값 구하는 알고리즘_java class Max3{ public static void main(String[] args){ Sanner stdIn = new Scanner(System.in); System.out.println("세정수의 최댓값을 구합니다"); System.out.print("a의 값"); int a = stdIn.nextInt(); System.out.print("b의 값"); int b = stdIn.nextInt(); System.out.print("c의 값"); int c = stdIn.nextInt(); int max = a; if(b> max) max=b; if(c>max) max=c; System.out.println("최댓값:"+max+); } } 최댓값 구하는 알고리즘. 2020. 6. 16.
state App.js state를 활용하여 버튼을 누르면 값 증가 또는 감소하기.. import React from 'react'; class App extends React.Component{ state ={ count: 0, }; add = () => { this.setState({count: this.state.count + 1}); }; minus = () =>{ this.setState({count: this.state.count -1}); }; render(){ return ( the number is: {this.state.count} Add Minus ); } } export default App; state에 conunt를 선언하고 자바의 갯터 셋터처럼 설정함. add, minus에 this.st.. 2020. 6. 11.
recursion - 순차탐색, 이진트리탐색 명시적 설계 1) 순차 탐색 int search (int [] data, int begin, int end, int target){ if(begin > end){ return -1; }else if(target == data[begin]){ return begin; }else{ return search(data, begin+1, end, target); } } 2) 이진트리 탐색 public static int binarySearch(String[] items, String target, int begin, int end){ if(begin > end) return -1; else{ int middle = (begin+end)/2; int compResult = target.compareTo(items[.. 2020. 6. 9.
map(); javascript 함수 friends.map(function(friend){ return friend +"🤣";}) 2020. 6. 5.
props 컴포넌트에서 컴포넌트로 전달하는 데이터 App.js function Food({fav}){ return I like {fav} } function App() { return( Hello ); } 결과 2020. 6. 4.
728x90
반응형