Fundamentals of Git

Explore some essential aspects of the version control tool Git. Concept Initially, as a newcomer, I confused Git with GitHub (a platform), not realizing Git is fundamentally a local tool. Some refer to it as a version control tool, a file system, or even a database with key-value pairs. To harness its capabilities, it’s crucial to understand the primary command: 1 git init This command creates a .git folder in

Functions in Kotlin

In this post, I aim to summarize the essential aspects of function syntax in Kotlin. While this post touches upon some commonly used functionalities, especially in Android development, it doesn’t delve deep into the advanced usages. Regular Functions Regular functions are the basic building blocks. Here’s a simple function that compares the lengths of two strings: 1 2 3 fun compare(a: String, b: String): Boolean { return a.length < b.length

Three.js Fundamentals

This blog post is primarily intended to document my learning journey with three.js. At its core, this framework is a JavaScript library built on top of WebGL, designed to help developers efficiently create 3D models and scenes. Here are some fundamental concepts and code snippets: Primary Classes First, let’s take a glance at the structural diagram: Renderer As seen from the above structural diagram, right at the top is the

0-1 Knapsack Problem

Introduction to the 0-1 Knapsack Problem The 0-1 Knapsack problem is a classic optimization problem. Imagine you have a bag with a certain weight capacity, and you have a set of items, each with its own weight and value. The problem is to determine which items to include in the bag to maximize its total value without exceeding its weight capacity. Brute Force The simplest way to tackle the 0-1

Recursively Traverse a Binary Tree

Traversal Order A binary tree offers three primary traversal methods: Pre-order, In-order, and Post-order. 1 2 3 4 5 6 1 / \ 2 3 / \ \ 4 5 6 pre-order: 1->2->4->5->3->6 in-order: 4->2->5->1->3->6 post-prder: 4->5->2->6->3->1 The root node appears first in pre-order traversal and last in post-order traversal. Leveraging this characteristic, one can uniquely construct a binary tree when provided with combinations of preorder-inorder or postorder-inorder arrays. Note