Random numbers are widely used in different applications. For example, when you are playing a video game, and some random event like weather changes from a sunny day to a rainy day, we might need to be able to generate the random number in order to determine whether we need to have the weather change.… Continue reading Random Engine in Modern C++
Author: Jun Zhang
Chrono Library in Modern C++
Hello, everyone. In this article, we are going to briefly talk about the Chrono library in the standard template library. First of all, in order to use the Chrono library, we first need to include the header chrono to our code. This header includes all the main methods related to time. #include <chrono> In general,… Continue reading Chrono Library in Modern C++
Tree Traversal (In-order / Level-order)
Last time we have talked about the pre-order traversal and post-order traversal of a binary tree (see here). Now let's look at another two traversals and how we can implement the traversal algorithm in C++. Let's first define the tree node here. For each node, we will have a value and two tree node pointers… Continue reading Tree Traversal (In-order / Level-order)
Smart Pointers in Modern C++
In this article, we are going to briefly discuss three smart pointers in modern C++. Basically, there are three types of smart pointers in C++: shared pointer, unique pointer, and weak pointer. Let's start with the shared pointer. 1. Shared Pointer When we use raw pointers, one critical problem is that we need to manage… Continue reading Smart Pointers in Modern C++
Regular Expression in C++
This article summarizes the regular expression syntax and usage in C++. Most of the content of this article is from Bo Qian's modern C++ tutorial series: https://www.youtube.com/playlist?list=PL5jc9xFGsL8FWtnZBeTqZBbniyw0uHyaH If you are new to C++, I personally highly recommend following his channel. His tutorial is well organized and easy to follow. If you just want to quickly… Continue reading Regular Expression in C++
Modern C++ Feature Lists (C++ 11)
This article summarizes the new features of C++ 11. This list is summarized according to Bo Qian's youtube channel: https://www.youtube.com/playlist?list=PL5jc9xFGsL8FWtnZBeTqZBbniyw0uHyaH If you are new to C++, I personally highly recommend following his channel. His tutorial is well organized and easy to follow. If you just want to quickly go through the list, just scroll down.… Continue reading Modern C++ Feature Lists (C++ 11)
Tree Traversal (preorder / postorder)
Let’s continue… First, I want to cite a great explanation about tree traversal. There are generally two approaches related to tree traversal: BFS and DFS. Bread First Search (BFS): We scan through the tree level by level, following the order of height, from top to bottom. The nodes on higher level would be visited before… Continue reading Tree Traversal (preorder / postorder)
Word Break I && II
Let's continue... Problem Statement: Word Break I Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequence of one or more dictionary words. Note: The same word in the dictionary may be reused multiple times in the segmentation. You may… Continue reading Word Break I && II
CryoVR
Introduction: Cryo-EM has received global recognition for its capacity to resolve high-resolution structures of macro molecules, and deservingly, was the topic of the 2017 Nobel Prize in Chemistry. This recent spike in attention to cryo-EM has developed a major need for training tools for incoming scientists. To this end, funding institutions such as NIH, have… Continue reading CryoVR
Planetary Landscape Generation
This is a course project for CGT581 geometry modeling class. The final goal for this project is to create a procedural generated planet. I implemented this demo using C++/OpenGL/GLSL. Some of the important features about the demo include: Implemented the adaptive level of detail to base planet geometry. The adaptive level of detail algorithm consists… Continue reading Planetary Landscape Generation
Unique Path I && II (Recursion and Dynamic Programming)
Problem Statement: Unique Path I A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the… Continue reading Unique Path I && II (Recursion and Dynamic Programming)
Search in Rotated Sorted Array
Problem Statement: Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). You are given a target value to search. If found in the array return its index, otherwise return -1. You may assume no duplicate exists in the array. Your algorithm's runtime complexity… Continue reading Search in Rotated Sorted Array