Grant6899 Blog

Time goes on. We live. We learn.

Thread Deadlock and Deadlock Prevention & Avoidance

Deadlock Characteristics Mutual Exclusion A mutual exclusion(mutex) is a program object that prevents simultaneous access to a shared resource. Hold and Wait A thread i...

Graph Algorithm Summary

Pre-assumptions We assume graphs discussed below have E edges and V vertices. Single-source shortest-path algorithm Dijkstra’s algorithm 1 function Dijkstra(Graph, source): 2 3 create ...

DFS Summary

What is DFS? Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data structures. One starts at the root (selecting some arbitrary node as the root in the case of a ...

Top-level const and Low-level const

Top-level const and Low-level const Top-level const: indicate that the pointer itself is a const. Top-level const can appear in any object type, i.e., one of the built-in arithmetic types,...

Big-O Cheat Sheet

Data Structures Data Structure Average cases Worst cases Insert Delete Search Insert Delete Search Array N/A ...

Effective C++ Notes(4)

Item 41: Understand implicit interfaces and compile time polymorphism The world of object-oriented programming revolves around explicit interfaces and runtime polymorphism. An explici...

Effective C++ Notes(3)

Item 26: Postpone variable definitions as long as possible Consider when to define variable when taking exception into consideration // this function defines the variable "encrypted" too soon std:...

Effective C++ Notes(2)

Item 13: Use objects to manage resources A general convention to manage resouce by objects: Resources are acquired and immediately turned over to resource-managing objects. Resource-managing ...

Type Conversion and Casting functions

Type Conversion A conversion operator is a special kind of member function that converts a value of a class type to a value of some other type. A conversion function typically has the general form...

Effective C++ Notes(1)

Item 1: View C++ as a federation of languages C. Way down deep, C++ is still based on C. Blocks, statements, the preprocessor, built-in data types, arrays, pointers, etc., all come from C....