Eat Study Love

먹고 공부하고 사랑하라

MAIN ISSUE

more

VS code C++ Debugging & Operator overloading

이번엔, C++ 코딩을 하며 자주 마주하는 디버깅의 현장을 살펴보겠다. 관련자료는 아래와 같다.  용량이 크진 않으니 VS Code를 통해 C++ 코딩 작업을 할 경우, 잘 참고해서 하면 되겠다. 기본적으로 디버깅할땐 print문을 통해서 디버깅하는 방법이 있고, VS Code 상의 Debug Extention을 이용하는 방법이 있다. 전자는 직관적이지만, 귀찮고 후자는 효과적이지만 방법을 터득하기가 귀찮다. 일단 간단하게 Debugging 실습을 진행해보자. #include #include using namespace std;int main(){ list lst = {1,2,3,4,5}; // i want to practice using pop_back function in list! ..

C++ & Algorithm 2025.02.03 0

Function Overloading and Templates

금번 C++ 공부에선, Function Overloading 과 Templates 부분을 공부하고 관련 내용을 실습해보겠다.실습자료는 아래와 같다.  기본적으로 Function의 parameter에는 defulat 값을 넣을 수 있다.int divide( int a, int b = 2 ) { return a/b;} Function의 Overloading이란, Function들끼리 같은 이름을 Share하는데 Parameter type에 따라서 Return이 달라지는 것이다. 이 때, Return type만 가지고는 Function들 끼리 overload 할 수 없다. 다음은, Function Overload의 예시다. 보면, mySwap이라는 함수가 있는데, 이름이 다 같아도 input data의 typ..

C++ & Algorithm 2025.02.01 0

C++ Object Oriented Programming(OOP), Overroad, Override 실습

C++과 관련된 시험에서 꼭 빠지지 않고 등장하는 것이 이 OOP 문제이다. OOP는 Class를 하나 만들어놓고, 그에 파생되는 객체를 가지고 노는 Programming이다. 이번에 해 볼 실습은, 2D Vector Class를 만들고, 해당 Class에 각 종 Operator를 Overroad 해본 뒤, OOP를 써서 Class 구현이 잘 되었는지 테스트 해보고, 2D Vector를 상속받은 Derived Class 3D Vector를 만들어 Class의 Inherit, Method의 Override를 잘 구현했는지 Test 해보겠다. 문제 풀이를 위한 Skeleton code는 아래와 같다.#include #include using namespace std;// Base class for 2D ve..

C++ & Algorithm 2025.01.09 0

Heap Implementation [1]

Algorithm Part의 기본적인 Data Structure인 Heap에 대해서 Implementation 연습을 시작해본다. Heap의 경우 Priority Queue라고도 생각하면 되고, Max/Min Heap으로 구분된다. 특징으론 Max Heap을 예로 들었을 때, Heap Data 구조에 입력되는 Data는 크기가 큰 순서(Max)대로 우선순위를 갖은 체 저장된다. 이 말은, Heap에서 특정 Data를 꺼낼 때(Deque) 가장 크기가 큰 녀석이 추출되는 것이다. 일반적으로 우리가 아는 queue구조에서 우선 순위만 선입선출이 아닌, Data 크기에 따라 결정된다는 것을 알고 있으면 된다. 따라서, 내부에 저장된 Data를 임의로 Search 할 수는 없지만 우리가 정한 Logic( Max..

C++ & Algorithm 2024.12.26 0

Linked list with Stack Node 문제

이번 문제는 Linked list를 C 코드로 구현하는 것인데, 특이점은 각 Node가 Stack 구조라는 것이다.즉 아래와 같이 Linked list Node가 존재한다는 것!  다시 말하면, 밖에서 봤을 땐 하나의 커다란 Stack인데 이것들이 내부에선 Linked list로 구성이 되어 있다는 것이다.문제의 조건은 아래와 같다.   1. 각 Stack Node에는 Max-capacity가 존재하다. Max-capacity를 넘어서면 새로운 Stack Node를 만든다.   2. list_size() method를 구현하라. 현재 원소가 존재하는 List Node(stack)의 개수를 반환한다.   3. push() method를 구현하라.   4. pop() method를 구현하라. 원소가 Link..

C 2024.12.23 0

VS code C++ Debugging & Operator overloading

이번엔, C++ 코딩을 하며 자주 마주하는 디버깅의 현장을 살펴보겠다. 관련자료는 아래와 같다.  용량이 크진 않으니 VS Code를 통해 C++ 코딩 작업을 할 경우, 잘 참고해서 하면 되겠다. 기본적으로 디버깅할땐 print문을 통해서 디버깅하는 방법이 있고, VS Code 상의 Debug Extention을 이용하는 방법이 있다. 전자는 직관적이지만, 귀찮고 후자는 효과적이지만 방법을 터득하기가 귀찮다. 일단 간단하게 Debugging 실습을 진행해보자. #include #include using namespace std;int main(){ list lst = {1,2,3,4,5}; // i want to practice using pop_back function in list! ..

C++ & Algorithm 2025.02.03 0

PostgreSQL SQL2NL(3)

PostgreSQL을 Python에 연결하려는 시도를 했다. 이 시도의 이유는, 결국 PostgreSQL에서 자체적으로 반환된 Naturl Language(NL)를 가지고 LLM을 거쳐 사람이 이해하기 쉬운 좀 더 정제된 NL로 변환을 하려는 것이다. 근데, 그 전에 일단 PostgreSQL 내부에서 최대한 Parsing 구조의 Rule base의 입각하여 SQL문을 NL로 투박하게나마 변환하려는 작업을 하려는데, 그 하부구조는 아래와 같다. 일단 NL2SQL 분야의 유명한 Bench Mark인 Bird 에 나오는 NL SQL Gold Pair를 이용해서 SQL문을 NL로 좀 바꿔보려는데, 문제는 SQL문의 종류가 너~~~~~~~~무나도 많다. 그 모든 것들에 대한 NL 변환 Rule 설정이 가능한가 ..

Research & Paper 2025.02.03 0

Function Overloading and Templates

금번 C++ 공부에선, Function Overloading 과 Templates 부분을 공부하고 관련 내용을 실습해보겠다.실습자료는 아래와 같다.  기본적으로 Function의 parameter에는 defulat 값을 넣을 수 있다.int divide( int a, int b = 2 ) { return a/b;} Function의 Overloading이란, Function들끼리 같은 이름을 Share하는데 Parameter type에 따라서 Return이 달라지는 것이다. 이 때, Return type만 가지고는 Function들 끼리 overload 할 수 없다. 다음은, Function Overload의 예시다. 보면, mySwap이라는 함수가 있는데, 이름이 다 같아도 input data의 typ..

C++ & Algorithm 2025.02.01 0

Maximum Employees to Be Invited to a Meeting(Depth-First Search,Graph,Topological Sort)

https://leetcode.com/problems/maximum-employees-to-be-invited-to-a-meeting/description/?envType=daily-question&envId=2025-01-26A company is organizing a meeting and has a list of n employees, waiting to be invited. They have arranged for a large circular table, capable of seating any number of employees.The employees are numbered from 0 to n - 1. Each employee has a favorite person and they will..

Coding_Practice 2025.01.26 0

Make Lexicographically Smallest Array by Swapping Elements(Array,Union Find,Sorting)

https://leetcode.com/problems/make-lexicographically-smallest-array-by-swapping-elements/description/?envType=daily-question&envId=2025-01-25You are given a 0-indexed array of positive integers nums and a positive integer limit.In one operation, you can choose any two indices i and j and swap nums[i] and nums[j] if |nums[i] - nums[j]| Return the lexicographically smallest array that can be obtai..

Coding_Practice 2025.01.25 0