Eat Study Love

먹고 공부하고 사랑하라

MAIN ISSUE

more

Max - heap을 Tree형태로 표현하기

C++ 알고리즘의 대표적인 자료구조인 Priority Queue의 근간이 되는 Heap 구조를 Complete Binary Tree형태로 표현하였다. Array가 아닌 Linked list로 표현하여서 Time complexity는 모두 enqueue / dequeue O( log N ) 이고, 코드를 구현하며 주의해야할 점은, heap property를 깨지 않기 위해 en/dequeue를 할 때마다 heapify-up/down을 시행해야 한다는 것이다. Enqueue는 그래서 일단 element를 Tree의 Last Node에 삽입하고, 그 친구를 Heap - up 하며 Dequeue는 일단 root와 last-node를 스위칭 한 다음에 last-node를 제거한다. 그리고 root자리에 있는 친구..

C++ & Algorithm 2025.02.21 0

MST(Minimum Spanning Trees), SSSP(Single Source Shortest Paths), APSP(All Pairs Shortest Paths)에 대한 고찰

Algortihm의 대표적인 친구들인 MST, SSSP, APSP에 대한 이론 공부 Review를 빠르게 진행해보려고 한다.한 번씩 봤던 내용이니까 이론을 빨리 다루고, Code와 익숙해져보자. 각각의 경우 종류는 많지만, 대표적으로 쓰이는 몇 가지만 적어보려고 한다. 1. Minimum Spanning Tree한 Grpah에서 가장 낮은 cost로 전체 vertices를 도는 것을 계산하는 알고리즘이다. 그리고 여기서 Spanning Tree란, 어떤 Graph의 모든 Vertex를 다 포함하고 있는연결구조를 말한다.개중에 가장 Total Weight 이 작은 친구를 Minimum Spanning Tree라고 부르는 것이다. 이 MST 중 가장 유명한 알고리즘 2개를 다루겠다. 첫 번째, Prim's ..

C++ & Algorithm 2025.02.14 1

SSSP(Single Source Shortest Path) / APSP(All-Pairs Shortest Path) 실습

Algorithm의 대명사인 Shortest Path와 관련된 실습이다.SSSP / APSP를 구현해보는 실습을 할 것이다. 대표적으로 FloydWarshall과 BellmanFord 알고리즘을 확인해보자. 실습자료는 위와 같다.#include #include #include #include // 아래 header는 내가 추가#include using namespace std;/*//////////////////////// Description ////////////////////////////There are n cities in a logistics network, numbered from 0 to n−1. The edges array represents the logistics routes bet..

C++ & Algorithm 2025.02.14 0

C++ function implementation(feat, priority queue & DP)

이번 실습의 주제는 C++ Function Implementation이다.실습의 목표는 아래와 같다.  애증의 DP문제의 경우, 이해가 좀 어려운데 주석과 아래 예시를 보면 그래도 좀 느낌이 온다. 근데 문제는 이 느낌이 항상 답지를 보고 나서야 온다는 것-_-..문제 풀기 전부터 이 느낌이 머리에 딱 꽂치는 사람은 진짜 프로그래밍 고수다. 분명허다!! 나머지 문제는 Priority queue를 이용해 풀면 쉽다. 코드는 아래에 공유#include #include #include #include #include // 내가 추가using namespace std; // 내가 추가#include struct ListNode { int val; ListNod..

C++ & Algorithm 2025.02.14 0

Llama3 Prompt Engineering(7)

https://eglife.tistory.com/347 Llama3 Prompt Engineering(6)https://eglife.tistory.com/340 PostgreSQL, LLM 연결(5)PostgreSQL Openai or Llama 연결 Settinghttps://eglife.tistory.com/338 PostgreSQL, LLM 연결(4)1.https://github.com/cloudquery/pg_gpt2.https://github.com/prabin-acharya/pg_gpt3.https://github.com/Jeeglife.tistory.com뭐, 일단 PostgreSQL extension(Postgres에서 사용가능한 customized function이라고 생각하면 된다.)으..

Research 2025.04.30 1

Llama3 Prompt Engineering(6)

https://eglife.tistory.com/340 PostgreSQL, LLM 연결(5)PostgreSQL Openai or Llama 연결 Settinghttps://eglife.tistory.com/338 PostgreSQL, LLM 연결(4)1.https://github.com/cloudquery/pg_gpt2.https://github.com/prabin-acharya/pg_gpt3.https://github.com/JelteF/pg_human4. https://github.com/pramsey/pgsql-openaeglife.tistory.com현재 검토중인 Model이 Llama3 중 Parameter 8b(The smallest) Model을 다루고 있기 때문에, 이 놈의 Promtpt..

Research 2025.04.25 0

SQL2NL Prompt Engineering - KCC(4) Last

https://eglife.tistory.com/345 SQL2NL Prompt Engineering - KCC(3)https://eglife.tistory.com/342 SQL2NL Prompt Engineering - KCC(2)https://eglife.tistory.com/341 SQL2NL Prompt Engineering - KCC(1)SQL2NL Module의 정확도를 향상시키는 법에대한 고찰이다. 일단 생각해낼 것은, 어찌어찌 SQL2NLeglife.tistory.com이제 가다(?)는 잡았으니 정말 논문 초안을 작성해야 한다. 主 주제는 SQL2NL Prompt Engineering이고, Table Schema를 사용하면 해당 건의 정확도가 올라간다는 점을 강조하고 동시에 "SQL Glo..

Research 2025.04.18 0

SQL2NL Prompt Engineering - KCC(3)

https://eglife.tistory.com/342 SQL2NL Prompt Engineering - KCC(2)https://eglife.tistory.com/341 SQL2NL Prompt Engineering - KCC(1)SQL2NL Module의 정확도를 향상시키는 법에대한 고찰이다. 일단 생각해낼 것은, 어찌어찌 SQL2NL 정확도 올리는 법을 찾았다고 쳤을때 그 것을 어찌eglife.tistory.com지난 시간 충격적인 결과,SQL to NL 모델을 이용할 때 되려 Naive한 Model이 Table Schema or Parsing Info가 추가된 Version보다 각 종 Accuracy Matrix 지표가 더 높았다.얼핏봐도 Naive한 version에서 각종 Score가 높게 나타..

Research 2025.04.14 0

English Natural Language Evaluation Matrix

영어 문장간의 Word 또는 Semantic(문맥) 을 기준으로 일치성, 통일성, Accuracy를 비교하는 Matrix에 대한 설명이다.SQL을 NL(Natural Language)로 변환하는 과정에서 NL이 기존 답안 NL과 비교했을 때 얼마나 정확도가 높게 반환되었는지 확인하는 지표로 사용할 수 있다. 물론, 프로그래밍언어와 달리 자연어 NL은 해당 지표들의 값이 높다고 무조건 정확하다고 말하기가 어렵다. 언어마다 원체 성질이 다양하다보니... 그래서 사실 제일 좋은 건, 특정 언어 Mother tongue 인간의 직접평가가 가장 정확하지만 그것은 현실적으로 Cost가 너무 많이 드릭에 대체재로 아래 MATRIX들을 많이 사용한다. 아래 코드 기준으로, 해당 Matrx들의 특징을 알아보자.# ✅ B..

Research 2025.04.10 0