생각의 표현들

LeetCode

[LeetCode] 153. Find Minimum in Rotated Sorted Array

Find Minimum in Rotated Sorted Array - LeetCode Can you solve this real interview question? Find Minimum in Rotated Sorted Array - Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,2,4,5,6,7] might become: * [4,5,6,7,0,1,2] if it leetcode.com 오름차순으로 정렬된 길이 n의 배열이 1에서 n회 사이로 회전한다고 가정합니다. 정렬된 회전 배열의 고유 원소의 개수가 주어지면, 이 배열의 최소..

LeetCode

[LeetCode] 33. Search in Rotated Sorted Array

Search in Rotated Sorted Array - LeetCode Can you solve this real interview question? Search in Rotated Sorted Array - There is an integer array nums sorted in ascending order (with distinct values). Prior to being passed to your function, nums is possibly rotated at an unknown pivot index k (1 nums[i]) { pivot = i-1; } } int ret = -1; ret = binarySearch(nums, target, 0, pivot); if (ret == -1) {..

LeetCode

HashTable LinearProbing 구현

HashTable을 LinearProbing으로 구현해 보았습니다. 해시테이블이란? 해시 테이블은 (Key, Value)로 데이터를 저장하는 자료구조 중 하나로 빠르게 데이터를 검색할 수 있는 자료구조입니다. 삽입,조회,삭제가 O(1)안에 가능하여 많이 사용됩니다. 구현 방법에는 링크드 리스트를 이용하는 방법과 LinearProbing방법이 있습니다. 링크드리스트를 이용해 구현하는 방법은 인터넷상에 잘 나와있기 때문에 LinearProbing방법으로 구현해 보겠습니다. 메서드 hashfunction put get remove isEmpty 구현 Key와 Value 형테로데이터를 저장하기위한 클래스 Entry를 선언합니다. public class Entry { K key; V value; public En..

LeetCode

[LeetCode] 162. Find Peak Element

Find Peak Element - LeetCode Can you solve this real interview question? Find Peak Element - A peak element is an element that is strictly greater than its neighbors. Given a 0-indexed integer array nums, find a peak element, and return its index. If the array contains multiple peaks, leetcode.com int 배열에서 좌,우 요소보다 큰 요소의 인덱스를 반환하는 문제입니다. O(log n) 시간 내에 실행되는 알고리즘을 작성해야 합니다. Example 1: Input: nums..

Sol b
'분류 전체보기' 카테고리의 글 목록 (16 Page)