Jan 6 · 4 min read · 트리나 그래프를 공부하다 보면 항상 함께 등장하는 개념이 있다. DFS / BFS Preorder / Inorder / Postorder 이 둘은 자주 묶여 설명되지만, 실제로는 역할과 레벨이 다르다.이번 글에서는 다음 질문들에 답하는 흐름으로 정리해본다. DFS는 왜 순회 방식이 3가지로 나뉘는가? 순회 코드는 같은데 visit 위치만 다른 건가? BFS에는 왜 preorder / postorder 같은 개념이 없는가? 실무에서...
Join discussionJan 6 · 6 min read · BFS Traversal — 4 Easy Rules Rule 1 — Start Put the starting vertex into a queue. Keep an empty visited set. Rule 2 — Take from Queue While the queue is not empty: Remove the front vertex from the queue. ⚠️ Key difference from BFSBFS → Queu...
Join discussionNov 27, 2025 · 10 min read · The financial services industry is experiencing a seismic shift. Generative AI and Large Language Models aren't just another tech trend—they're fundamentally reimagining how financial professionals work, analyze data, and serve clients. If you're enr...
Join discussionSep 7, 2025 · 4 min read · Problem You are given an adjacency list, adj of Undirected Graph having unit weight of the edges, find the shortest path from src to all the vertex and if it is unreachable to reach any vertex, then return -1 for that vertex. Examples : Input: adj[][...
Join discussionSep 7, 2025 · 3 min read · Problem Given a Directed Acyclic Graph of V vertices from 0 to n-1 and a 2D Integer array(or vector) edges[ ][ ] of length E, where there is a directed edge from edge[i][0] to edge[i][1] with a distance of edge[i][2] for all i. (Geeks) Find the short...
Join discussionAug 24, 2025 · 2 min read · Problem There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates that you must take course bi first if you want to take course ai. For...
Join discussionAug 22, 2025 · 3 min read · The Graph → The Python code to find the shortest path in the above ⬆️ graph → from collections import deque from typing import List, Tuple, Optional def bfs(n: int, graph: List[List[int]], source: int) -> Tuple[List[float], List[int]]: """ ...
Join discussion
Aug 17, 2025 · 4 min read · Problem Given a Directed Acyclic Graph (DAG) of V (0 to V-1) vertices and E edges represented as a 2D list of edges[][], where each entry edges[i] = [u, v] denotes a directed edge u -> v. Return the topological sort for the given graph. Topological ...
Join discussionAug 14, 2025 · 7 min read · Preface After watching the first lecture on Search and organizing my own notes, I now have a solid understanding of the course content. It’s time to try a problem set to reinforce what I’ve learned. Problem Set 0: Degrees Requirements Analysis The pr...
Join discussion