분류 전체보기
-
LCS(Longest Common Subsequence - 최장 공통 수열) 알고리즘TIL(today i learned) 2023. 7. 27. 14:28
Longest Common Subsequence 그리고 Longest Common Substring LCS에는 최장 공통부분수열(Longest Common Subsequence)과 최장 공통 문자열(Longest Common Substring)을 말한다. 문자열 ABCDEF와 GBCDFE를 이용하여 차이점을 예시로 들어보면 위 그림처럼 Subsequence은 연속적일 필요 없이 문자를 뛰어넘어도 되지만 Substring 같은 경우에는 문자가 아예 일치해야만 한다. 이를 토대로 각각 점화식을 만들어보면 다음과 같다. Substring if (A[i] == B[j]) dp[i][j] = dp[i - 1][j - 1] + 1; else dp[i][j] = 0; Subsequence if (A[i] == B[j..
-
LIS(Longest Increasing Subsequence - 최장 증가 수열) 알고리즘TIL(today i learned) 2023. 7. 25. 17:02
해당 알고리즘은 배열중 가장 긴 증가수열을 찾는 알고리즘이다 예를 들어 1 4 2 5 3 2 라는 배열이 있다고 가정해 보자 1 2 3 4 5 2 {1,2,3}, {4,5}, {2}중에서 가장 긴 증가수열을 찾으면 {1,2,3}이다. 이러한 문제를 해결하고자 나온 것이 LIS(Longest Increasing Subsequence - 최장 증가수열) 알고리즘이다. 기본적으로 DP를 사용하면 N^2이 걸리고 이분탐색사용 시 NlogN의 시간이 걸린다. 예시 코드) for (int k = 0; k < n; k++){ length[k] = 1; for (int i = 0; i < k; i++){ if(arr[i] < arr[k]){ length[k] = max(length[k], length[i] + 1); ..
-
리액트의 구조웹 and 앱 프로그래밍 2023. 7. 20. 21:31
리액트에서는 함수로 태그를 커스터마이징 할 수 있다. import React from 'react'; import './Ribbon.css'; const Ribbon = () => { return ( 더 알아보기하고 무료 배송, 스페셜리스트 지원 등의 혜택을 받으세요. ); }; export default Ribbon; 이를 토대로 해당태그의 데이터를 json으로 저장하여 각각 다른 내용을 화면에 보여줄 수 있다.(코드 재사용성 UP!) (예시) https://velog.io/@hye_rin/React-%EC% BB% B4% ED% 8F% AC% EB%84% 8C% ED% 8A% B8-%EC% 9E% AC% EC%82% AC% EC% 9A% A9% ED%95%98% EA% B8% B0 [React] 컴포..
-
알면 도움되는 bitmaskTIL(today i learned)/알고리즘 2023. 7. 20. 21:15
https://www.acmicpc.net/problem/17497 17497번: 계산기 첫 번째 줄에 버튼을 누른 횟수 K (0 ≤ K ≤ 99) 를 출력합니다. 누른 횟수를 최소화 하지 않아도 됩니다. 단, 누른 횟수가 99번을 넘으면 안됩니다. 만약 99번 안에 N을 만드는 방법이 존재하지 않는 www.acmicpc.net 2진수 연산 특징 a)2를 곱하면 현재 비트뒤에 단순히 0이추가된다. b)현재비트의 맨뒤가 0이면 짝수,1이면 홀수 이다. c)(X & 1)연산은 홀수이면 1 짝수이면 0
-
리액트란?웹 and 앱 프로그래밍 2023. 7. 5. 13:33
리액트는 처음에 페이스북에서 사용하던 오픈소스 라이브러리로 2015년 6월 공식 발표되었다. 처음에는 모바일 앱 개발에만 적용되었으나 현재는 데스크톱 애플리케이션에서도 활발히 사용되고 있다. 특히 프런트엔드 개발 시 필수적인 요소로 자리 잡으면서 대세로 떠오르고 있다. 그럼 지금부터 본격적으로 리액트의 장점과 단점에 대해 알아보도록 하자. 장점 1 : 빠른 속도 리액트는 컴포넌트 기반의 경량 렌더링 엔진 으로써 매우 빠른 속도를 자랑한다. 따라서 서버 부담이 적고 메모리 사용량도 적어 최적화가 용이하다. 뿐만 아니라 코드 재사용률이 높고 유지보수가 간편하다는 장점도 있다. 장점 2 : 높은 생산성 리액트는 단일 파일 구조 로써 복잡한 JSX 대신 간결한 표현법을 제공한다. 이로 인해 가독성이 좋고 직관적..