본문 바로가기

Most Frequently Occurring Item in an Array Most Frequently Occurring Item in an Array (Java)Find the most frequently occurring item in an array.Example: The most frequently occurring item in [1, 3, 1, 3, 2, 1] is 1.If you're given an empty array, you should return null (in Java) or None (in Python).You can assume that there is always a single, unique value that appears most frequently unless the array is empty. For instance, you won't be.. 더보기
Stable / Unstable Sort의 차이 http://egloos.zum.com/entireboy/v/3516993 강의를 들었지만, 설명이 이해가 안되서 검색해봤다. 이미 잘 정리한 내용이 있어서 다행인 듯 더보기
정렬 알고리즘(버블, 선택, 삽입) 버블정렬 코드 Main.classpublic class Main { public static void main(String[] args) { // write your code here int[] data = {6, 78, 1, 45, 3, 2, 8,11,66}; new BubbleSort(data).sort(); System.out.println(Arrays.toString(data)); } } BubbleSort.classpublic class BubbleSort { private int[] data; public BubbleSort(int[] data) { this.data = data; } public void sort() { for (int i = 0; i < data.length - 1; i++.. 더보기
Introduction to Algorithms (19/103) Insertion Sort까지 완료 더보기
Introduction to Algorithms (11/103) Total 103 section 중 11 section 완료 (bubble sort) 더보기
Udemy 강의 현재 강의가 세일중이라 우선 3개만 구입했다. 파이썬으로 인터뷰 준비하는게 더 편하다는 평이 많아서 파이썬으로 구매할까 했는데... 일도 워낙 바쁜 관계로 좀 더 친숙한 자바로 하는게 나을 듯(초창기 api개발 때 장고로 같이 짰는데 지금 안드로이드만 해서...ㅠㅠ) 더보기
리스트에 중복된 값 제거하기 영어로 찾으면 how to remove duplicate value in list? 이정도일려나 -_-;; 사실 알고리즘이라고 하기에도 그렇지만 그냥 간단한거라도 적어볼려고 한다 stackoverflow나 인터넷에 찾오면 set을 이용한게 가장 많이 나오는데 재밌는 점은 set을 이용할 경우 list의 순서가 보장되지 않는 다는 댓글이 있었다 list의 순서까지 보장을 원한다면 LinkedHashSet을 이용하자! List idList = new ArrayList();idList.add(1);idList.add(2);idList.add(3);idList.add(1);idList.add(1);idList.add(3);idList.add(4); - 이부분이 중복제거해주는 부분idList = new Array.. 더보기