MarkSon
-
-
프로그래머스 완주하지못한선수 [C++] feat.다양한 풀이방법소프트웨어전공/알고리즘 문제풀이 2021. 10. 6. 21:20
https://programmers.co.kr/learn/courses/30/lessons/42576 코딩테스트 연습 - 완주하지 못한 선수 수많은 마라톤 선수들이 마라톤에 참여하였습니다. 단 한 명의 선수를 제외하고는 모든 선수가 마라톤을 완주하였습니다. 마라톤에 참여한 선수들의 이름이 담긴 배열 participant와 완주한 선수 programmers.co.kr [문제 접근] 두 개의 벡터 스트링 배열이 주어지고, 이 둘을 비교한다. 참가자 중에 동명이인이 있다는 조건이 있지만, 완주하지 못한 선수는 단 한명이기 때문에 어려운 요구사항은 아니었다. 반복문을 돌며 두 배열을 비교하고 같은것만 참가자 배열에서 삭제해주면 결국 단 하나의 요소만 남을 것이다. [C++ _ 중첩 반복문] [새로 알게된 것] ..
-
Hash [C++]소프트웨어전공/자료구조 with C++ 2021. 10. 6. 21:12
https://woo-dev.tistory.com/106 [C++] 해시맵(Hashmap)을 이해해보자 | std::unordered_map | 기술면접 해당 포스팅은 unordered_map 클래스 자체보단 해시맵/해시테이블에 대한 내용을 다룹니다. [기존의 STL std::map] C++ 11 이전의 기존 STL 컨테이너인 std::map은 요소가 자동으로 오름 차순으로 정렬되는 woo-dev.tistory.com 위 블로그의 글을 참고하였음 해시는 각각의 이름에 대해서 유일한 값을 가지게 한다 각 이름에 대해 유일한 key 값을 가지도록! key값을 이용해서 자료에 접근한다면 O(1)시간만에 접근가능하다 ( 1 : 1 ) !
-
[정렬 알고리즘] 기수정렬 with C++소프트웨어전공/알고리즘 개념 2021. 10. 4. 15:12
이번 장에서는 기수정렬에 대해 알아보자. 기본적인 내용은 위키피디아를 참고하였음! https://ko.wikipedia.org/wiki/%EA%B8%B0%EC%88%98_%EC%A0%95%EB%A0%AC 기수 정렬 - 위키백과, 우리 모두의 백과사전 기수 정렬(radix sort)은 기수 별로 비교 없이 수행하는 정렬 알고리즘이다. 기수로는 정수, 낱말, 천공카드 등 다양한 자료를 사용할 수 있으나 크기가 유한하고 사전순으로 정렬할 수 있어야 한다 ko.wikipedia.org 기수 정렬(Radix sort)는 기수 별로 비교 없이 수행하는 정렬 알고리즘이다. 기수에는 다양한 자료를 사용할 수 있다. 여기서 기수는 크기가 유한하고 사전순으로 정렬할 수 있어야 한다. 기수의 예로는 정수(...., 0, 1..
-
백준 1008번 : A/B [C++]소프트웨어전공/알고리즘 문제풀이 2021. 9. 28. 20:52
https://st-lab.tistory.com/212 [백준] 1008번 : A/B - [C++] www.acmicpc.net/problem/1008 1008번: A/B 두 정수 A와 B를 입력받은 다음, A/B를 출력하는 프로그램을 작성하시오. www.acmicpc.net 문제 알고리즘 [접근 방법] 이 문제는 '부동 소수점'에 대한 이해를 필요로.. st-lab.tistory.com 해당 블로그가 설명이 잘 되어있어 참고했다. 컴퓨터는 비트로 수를 표현한다. 음수는 2의보수로 표현가능함을 전공 기초를 통해 이미 배웠다. 그러나 소수는 과연 어떻게 표시야 하는지? 1/3은 0.33333......... 무한한 소수이다. 정확하게는 표현할 수 없다. 결국 근사치를 표현하는것이 최선이며 정확한 값에 조금..
-
프로그래머스 폰켓몬 _ [C++]소프트웨어전공/알고리즘 문제풀이 2021. 9. 28. 18:51
https://programmers.co.kr/learn/courses/30/lessons/1845 코딩테스트 연습 - 폰켓몬 당신은 폰켓몬을 잡기 위한 오랜 여행 끝에, 홍 박사님의 연구실에 도착했습니다. 홍 박사님은 당신에게 자신의 연구실에 있는 총 N 마리의 폰켓몬 중에서 N/2마리를 가져가도 좋다고 했습니다. programmers.co.kr 오늘 알고리즘 수업시간 퀴즈로 출제 되었다. 구현은 못했는데, 손코딩으로 어떻게 풀어야 되겠다 정도는 생각해낼 수 있었다. 여러가지 풀이가 있는데 일단 수업때 해설과 가장 유사한 코드부터 찾아보았다.
-
C++ 숫자의 총 개수소프트웨어전공/알고리즘 문제풀이 2021. 9. 26. 22:49
https://www.inflearn.com/course/%EC%95%8C%EA%B3%A0%EB%A6%AC%EC%A6%98 it 취업을 위한 알고리즘 문제풀이 (with C/C++) : 코딩테스트 대비 - 인프런 | 강의 알고리즘과 자료구조를 이용해 문제해결력을 기르는게 주 목적입니다., 문제를 풀면서 자료구조와 알고리즘 기초·중급 개념을 확실히 잡고 다양한 문제를 통해 어떤 문제도 해결할 수 있는 문 www.inflearn.com 문제는 쉽게 이해했는데, 코드로 구현을 못했다. 이번 문제는 코드가 아주 짧고, 풀이도 이해가 잘 갔는데.. 오래 붙들고 있어도 이걸 생각해 낼 수 있었을까? 하는 의구심이 든다 1 ~ 99999까지 조건문을 덕지덕지 붙여서 count를 하는 방식도 떠올려 보았으나 출제의도도..