목록Computer/자료구조 (24)
Machineboy空

① C#의 대표 자료 구조Array : 配列List : リストLinkedListDictionary : 連想配列HashSet : ハッシュセット 중복을 허용하지 않는다.SortedSet : 중복 허용하지 않으며, 정렬된 순서로 요소 저장TupleQueuePriorityQueueStack② 동작에 따른 분류 - 삽입, 삭제, 검색, 정렬, 길이 삽입(挿入: そうにゅう, 追加: ついか)맨 뒤에 추가: List.Add() , HashSet.Add(), SortedSet.Add() void 반환List list = new List();list.Add(1); // {1}list.Add(2); // {1,2}list.Add(3); // {1,2,3}HashSet set = new HashSet();set.Add(1)..

Circular Buffer란?생산자와 소비자 처리 사이의 통신에 버퍼를 제공하기 위해 일정량의 기억 장치를 할당한다.그 로직이 원형으로 형성되는 버퍼를 말한다.고정적인 크기: queue with a maximum size, constrained size or capacity, stores data in a fixed-size array원형으로 탐색: continue to loop back over itself in a circular motionCircular Buffer의 작동 방식두 개의 포인터(front, back)로 읽을 위치, 삭제할 위치, 쓸 위치 등을 정한다.storing two pointer to the front and back of the structure버퍼가 모두 차면 가장 오래된..

Linked List를 간략하게 설명한다면?a list of nodes that are linked together.singly linked listdoubly linked listLinear data structures : 선형 데이터 구조sequence(순서와 규칙)가 있다hopscotch처럼 끝에 다다르기 위해서는 순차적으로 모든 노드를 지나쳐야 한다.LinearNon-LinearArray, linked listhashes, trees, graphsMemory Management같은 선형 데이터인 Array와 linked List의 차이가 뭘까? 7개의 문자를 저장하는 Array가 만들어지면, 연속된 7byte짜리의 메모리 칸을 마련해두어야 한다.하지만, linked list는 연속된 single ..
Tuple이란?The tuples feature provides concise syntax to group multiple data elements in a lightweight data structures.여러 값을 변수 하나에 저장할 수 있는 자료형값 형식// 1. 튜플 선언(필드 이름 X) 및 값 접근(double, int) t1 = (4.5, 3);Console.WriteLine(t1.Item1);Console.WriteLine(t1.Item2);// 2. 튜플 선언(필드 이름 O) 및 값 접근(double Sum, int Count) t2 = (4.5, 3);Console.WriteLine(t2.Sum);Console.WriteLine(t2.Count);// 3. 튜플 선언 (암시적)var t ..

1.1.1 Hashing Introduction this algorithm's often computer science's favorite algorithm, because you're going to find the results of hashing, it's going to give us a fantastic run time for certain operations. Mathematically, we define hashing as a keyspace(table) that we want to transform into a number of different values. So, everything inside of our keyspace is going to be every possible key t..

4.1 Heap introduction 제거 연산을 하는 데 걸리는 시간복잡도를 고려하면, 배열이나 리스트는 O(n)이라 굉장히 비효율적. 그렇다면 트리 구조를 생각해보자. 이진 검색트리의 경우 너무나 견고한 규칙에 따라 구성되어있기 때문에 이것 또한 성능 저하를 일으킨다. 그래서 트리의 아이디어를 가져오되, 노드가 우선순위를 가지고 있는 우선순위 큐를 활용한 힙을 만들어 볼 것 the remove operation is not having any parameters, it's simply going to take the minimum value found in the entire data structure, and remove it and return it back to the user. We want..

3.2.1 B-Tree Introduction 지금까지, 이진트리, AVL Tree, 배열, 리스트 등의 알고리즘을 살펴봤는데 이건 빅오 표기법에 따라 엄청난 런타임 퍼포먼스를 보여준다. but, Big O notation doesn't explain everything. In fact, Big O notation assumes a uniform access time for all of our data. But in reality, uniform access time for all of our data isn't actually the case. Real Application Imagine storing Facebook profiles for everyone in the US. How many recor..

3.1.1 Balanced BST Balanced BSTs are height-balanced trees that ensures nearly half of the data is located in each subtree. 불균형한 BST를 균형하게 바꾸는 알고리즘을 개발해보자. BST Sub-structures Example: BST Insert Consider a new node inserted into an initially balanceed BST: We identify the deepest node in the tree that is out of balance: BST Rotation Generic Left Rotation *arbitary = random BST Insert, Example #2..