Eat Study Love

먹고 공부하고 사랑하라

분류 전체보기 335

Type Casting & Exception Handling + OOP 실습

C++을 이용해서 Type Casting 과 Exception Handling을 해보겠다. Type Casting이란 특정 Variable을 다른 data type으로 변화시키는 것이며 종류로는 1. C-style Casting2. Static cast3. Dynamic cast4. Const cast5. Reinterpret cast 이렇게 다섯가지 정도를 알아보자.Elec* elec = new pikachu();Fire* char = (Fire*)elec;// Compile error는 없지만 ERROR static_cast 으로 compile time에 casting을 걸어버려서 깔끔하다.  Exception Handling은 Try - Catch 구문이다.일단 try 안쪽에 있는 구문을 실행해보고..

External Sorting and Hashing[7]

Database에 있는 Data들이 Sorting이 되어 있냐 아니냐에 따라서 Update performance차이가 많이 난다. 그만큼 Data의 Sorting이 매우 매우 중요하다는 것. SQL문의 Order by외에도 사실 DISTINCT, Group by, BULK LOADING(B-tree optimization) 등을 사용할 때도 Data Tuple들이 Sorting되어 있으면 좋다. 즉, Data는 기본적으로 Memory보다 크므로 Disk에서 Memory로 효율적으로 Data를 읽어 오려면 Data들을 Sort시키는 게 필요하다. DBMS에서는 보통 이 때 Merge-Sort를 사용하고, 이번엔 이와 관련된 공부내용이다.

Permutations(Array,Backtracking)

Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order. Example 1:Input: nums = [1,2,3]Output: [[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,1,2],[3,2,1]]Example 2:Input: nums = [0,1]Output: [[0,1],[1,0]]Example 3:Input: nums = [1]Output: [[1]] Constraints:1 -10 All the integers of nums are unique.뭔가 기본적인 컨셉의 문제인데, 이게 또 한 번쯤은 집고 넘어가줘야 찝찝한게 없다..

Coding_Practice 2025.02.10