Blog Content

  • python3로 Circular Queue 구현하기

    Category Algorithms on 2022. 9. 14. 22:14

    python3로 Circular Queue 구현하기 __ init __() 먼저 데이터 구조의 초깃값을 정한다. Queue의 크기를 k로 두고, 값을 담을 수 있게 길이가 k인 리스트 queue_list 를 만든다. Queue에는 두개의 포인터가 필요하다. 한개는 Front를 가리켜야 하고, 다른 하나는 Back을 가리켜야 한다. def __init__(self, k: int): self.size = 0 # 처음 리스트의 길이 self.max_size = k # 리스트의 길이 self.queue_list = [0] * k # Queue를 담을 리스트 self.front = self.rear = -1 # pointer enQueue() enQueue() 는 Circular Queue에 값을 삽입하는 함수이..

    Read more
  • 블로그 다시 시작

    Category Daily on 2022. 9. 14. 21:58

    Github, Medium, Notion 등에 가끔 블로그 글을 올리곤 했다. 글쓰는 방법이 편하지 않다보기 github blog나 medium(유입은 많은데 한국어 지원과 편집이 불편)은 손이 잘 가지 않았다. Notion은 점점 무거워지면서 개인 노트로만 활용하고 있다(뎁스가 깊어지면 사용하기 불편해지는 단점도...). Tistory가 그래도 여러 조건에 가장 부합하다고 생각하여 Medium과 함께 관리하며 다시 운영해보려고 한다. 월 1회라도 꾸준히 쓰는 것이 목표!

    Read more
  • [React] 새 페이지 렌더링 시 상단에서 시작하기

    Category Programming/JavaScript on 2018. 9. 30. 15:34

    리액트는 새 페이지를 렌더링한 후 스크롤을 맨 위로 올려주지 않는다. 그래서 별도로 컴포넌트를 만들어서 설정해주어야 한다. 먼저 ScrollToTop.js 컴포넌트를 만든다. import React, { Component } from 'react'; import { withRouter } from 'react-router'; class ScrollToTop extends Component { componentDidUpdate(prevProps) { if (this.props.location !== prevProps.location) { window.scrollTo(0, 0) } } render() { return this.props.children } } export default withRouter(S..

    Read more
  • [R] 결측값 데이터 다루기

    Category Statistics/R on 2018. 4. 25. 12:54

    R_Missing_Values.md 1. 결측값 단순 삭제 na.omit() 결측값이 있는 행을 삭제하는 함수 example > dat dat a b c d 1 1 5 a e 2 2 6 b 3 3 7 c f 4 4 NA g > dat dat a b c d 1 1 5 a e 3 3 7 c f 2행, 4행이 삭제된 것을 확인할 수 있다. 2. Multiple Imputation 다중대체법 m번의 대치를 통해 m개의 가상 자료를 만들어서 대체하는 방법이다. Multiple imputation is a statistical technique for analyzing incomplete data sets, that is, data sets for which some entries are missing. Appli..

    Read more
  • [python] 리스트 변수를 반복문 돌리기 예시

    Category Programming/Python on 2018. 4. 25. 12:51

    python_for_loop.md students = [] student1_info = { "first_name": "Martin", "las_name" : "Lawrence", "student_no": 9854 } student2_info = { "first_name": "Robert", "las_name" : "Gant", "student_no": 6790 } student3_info = { "first_name": "George", "las_name" : "Murphy", "student_no": 4728 } for i in range(1, 4): students.append(eval('student%d_info'% (i))) print(students) eval() : 실행 가능한 문자열을 입력 ..

    Read more