실행 컨텍스트
·
Frontend/Javascript Essentials
먼저, 실행 컨텍스트를 바르게 이해하면더보기 자바스크립트가 스코프를 기반으로 식별자와 식별자에 바인딩된 값(식별자 바인딩)을 관리하는 방식호이스팅이 발생하는 이유클로저의 동작 방식태스크 큐와 함께 동작하는 이벤트 핸들러비동기 처리의 동작 방식을 이해할 수 있다. 실행 컨텍스트_execution context ? 실행 컨텍스트는 자바스크립트의 동작 원리를 담고 있는 핵심 개념으로서, 아래와 같은 특징을 갖는다.자바스크립트 코드가 실행될 때, 해당 코드의 평가 및 실행에 필요한 환경 정보를 담는 객체이다.실행 컨텍스트는 함수 호출 시마다 생성되며, 스코프 체인, 변수 환경, this 값 등을 포함한다.실행 컨텍스트는 콜 스택에 쌓이며, 가장 위에 있는 컨텍스트만 실행된다. 소스코드의 평가와 실행모든 소스코..
637. Average of Levels in Binary Tree
·
Coding Test/LeetCode
난이도: 쉬움 (Easy)링크: LeetCode 637풀이 날짜: 2025/10/09(품) 1. 문제 이해 주어진 이진 트리에서 각 레벨(level)별 노드 값의 평균을 구해야 한다.즉, 루트부터 시작해 같은 깊이의 노드들을 모아 평균을 내고, 이를 배열로 반환한다.2. 접근 방식 및 자료 구조이 문제는 두 가지 방식으로 접근할 수 있는데, 나의 경우 깊이 우선 탐색 방식으로 풀었다. DFS 방식 (깊이 우선 탐색)각 노드를 방문하면서 depth를 추적한다.depth별로 값을 모으기 위해 result를 객체 형태로 관리한다.예: { 0: [3], 1: [9, 20], 2: [15, 7] }모든 노드를 탐색한 후, 각 배열의 평균을 계산한다.BFS 방식 (너비 우선 탐색)큐(queue)를 사용해 레벨 단위..
199. Binary Tree Right Side View
·
Coding Test/LeetCode
난이도: 중간 (Medium)링크: LeetCode 199풀이날짜: 2025/10/03(못품), 2025/10/09(품) 1. 문제 이해 주어진 이진 트리에서, 오른쪽 측면에서 보이는 노드들의 값을 반환해야 하는 문제로,각 레벨(level)마다 가장 오른쪽에 위치한 노드만 결과값으로 포함시켜야 한다.2. 접근 방식 및 자료 구조나는 DFS 방식으로 풀었으나, 문제 의도에는 BFS 방식이 더 적절해 보인다. 방법 1: DFS (오른쪽 우선 탐색) 깊이(Depth)를 추적하면서 오른쪽 자식부터 탐색한다.각 깊이에서 처음 방문한 노드가 그 레벨의 가장 오른쪽 노드가 된다.depth === result.length 조건을 통해 해당 깊이에서 아직 추가되지 않은 노드만 결과에 넣는다./** * Definition..
Linear and Nonlinear Data Structures(In progress)
·
Computer Science/Data Structure
Linear Data StructuresA linear data structure is a structure where elements are arranged in a sequential order.Examples: Linked List, Array, Vector, Stack, Queue.1) Linked ListA structure where nodes containing data are connected via pointers, maximizing space efficiency.Insertion/Deletion: O(1)Search/Access: O(n) OperationTime ComplexityNotesLookupO(n)Must traverse from headAssignO(n)Same reaso..
URI, URL and URN
·
Computer Science/Network
URI, URL and URNA Uniform Resource Identifier (URI)is a string of characters that uniquely identify a name or a resource on the internet.URIs have two specializations known as Uniform Resource Locator (URL), and Uniform Resource Name (URN).A URI identifies a resource by name, location, or both.A Uniform Resource Locator (URL)is a type of URI that specifies not only a resource, but **how to reach..
Structure of CPU scheduling algorithm and each algorithm
·
Computer Science/Operating System
CPU SchedulerThe CPU scheduler assigns CPU time to threads (units of work) from processes according to a scheduling algorithm.These algorithms aim to:Maximize CPU utilizationMaximize the amount of work done in a given timeMinimize the number of processes in the ready queueMinimize response time Non-Preemptive SchedulingIn non-preemptive scheduling, a process voluntarily releases the CPU;the OS d..