English Article

Tries

Tries It is commonly used to represent a dictionary for looking up words in a vocabulary Implementation https://leetcode.com/problems/implement-trie-prefix-tree/ Trie() Initializes the trie object. void insert(String word) Inserts the string word into the trie. boolean search(String word) Returns true if the string word is in the trie (i.e., was inserted before), and false otherwise. boolean startsWith(String prefix) Returns true if there is a previously inserted string word that has the prefix, and false otherwise.

Tree

Tree Properties Every tree has a special node called the root node. The root node can be used to traverse every node of the tree. It is called root because the tree originated from root only. If a tree has N nodes(vertices), the number of edges is always one less than the number of nodes (i.e., N-1). If it has more than that, it’s called a graph not a tree.

Infrastructure Setup Guide on AWS with Terraform

Infrastructure Setup Guide This document outlines the steps for building a deployment environment for a web service on using AWS and Terraform. Infrastructure CI/CD is also achieved through Terraform Cloud and GitHub Actions. Basic explanations about Terraform are provided. Please note that the information in this document is current as of December 17, 2021. The tools you are using, such as Terraform and Terraform Cloud, may have been updated, so

Hash Set and Hash Table

The Principle of Built-in Hash Table The key value can be any hashable type. A value that belongs to a hashable type has a hash code, and this code is used to get the bucket index. Each bucket contains an array to store all the values in the same bucket initially If there are too many values in the bucket, these values will be stored in the form of height-balanced BST so that look-up can be more efficient.

OOP Random Notes

Intro Random notes of relating OOP Terminology Parameter A parameter is a named variable passed into a function. Parameter variables are used to import arguments into functions. The difference between parameters and arguments Function parameters are the names listed in the function’s definition. Function arguments are the real values passed to the function. Parameters are initialized to the values of the arguments supplied. MDN Parameter Override Overriding a method means

Binary Tree

Overview A tree is a frequently-used data structure to simulate a hierarchical tree structure. Each node of the tree will have a root value and a list of References to other nodes that are called child nodes. From graph view, a tree can also be defined as a directed acyclic graph that has N nodes and N-1 edges. A Binary Tree is one of the most typical tree structures. As the name suggests, a binary tree is a tree data structure in which each node has at most two children, which are referred to as the left child and the right child.

Linked List

Introduction The linked list is a linear data structure. There are two types of linked lists, the singly linked list and the doubly linked list. Singly Linked list The linked list elements are not stored at a contiguous location; the elements are linked using pointers. Advantages over arrays Dynamic size Ease of insertion/deletion (Need to move all elements after targeted element in array) Implementation class Node(object): def __init__(self, val): self.