Tags / computer science

Fixing Grub2 Theme Preview on Opensuse Tumbleweed

To use Grub2 theme preview on openSUSE, two environment variables needs to be overridden.

Making Score In URL

I’m excited to publish my new project, Score In URL, a simple, privacy-friendly, sheet music sharing service, where the entire content is encoded in the URL itself as a query parameter.

Test Md Page

When you are tweaking your blog, creating a new CSS rule, or making a new theme, it is not uncommon

Theme-less Hugo, Almost Pure HTML, Styled with MVP CSS

Theme-less Hugo As popular as theming is, I can’t help but feel unsatisfied by a plug-and-use theme made by someone else.

A Constant Solution to Code-Fights Apple Boxes Problem

The Apple Boxes Problem The problem can be simply put: Input: $k$ Output: let $r$ be the sum of the square of each even integer no larger than $k$, and $y$ be that of the odd.

Count 1s in Range

在 codefights 上做到了一个很有意思的题。给你 a, b 两

Valid Number - By DFA

Introduction to the Problem The question asks the programmer to validate whether a string is a valid representation of a number.

Exceptional Control Flow

Overview A processor accesses a sequence of instructions when it operates. The transition from one to the next, is called control transfer.

Binary Search Tree implemented by C++

This is a simple implementation of binary search tree implemented by C++. Here are the methods of my BST: class Node { public: Node *left, *right, *parent; int key; }; class BST { private: Node *nil; public: BST(); Node* root(); // Traversals void inorder(); void inorderRec(Node*); void inorderIter(); void preOrder(); void preOrderRec(Node*); void postOrder(); void postOrderRec(Node*); // Search Operations Node* find(int); Node* minimum(Node*); Node* maximum(Node*); Node* successor(Node*); Node* predecessor(Node*); // Element Operation void insert(int); void insert(Node*); void remove(int); void remove(Node*); void transplant(Node*, Node*); bool empty(); };I will talk about some of the implementations.

Production of Sentences and Properties of Languages: Parsing Techniques Notes (2)

Generating Sentences sentence vs. sentential sentence all symbols belongs to terminals (a valid element of the language) sentential may contain non-terminals, an intermediate form during sentence production Example: For a language where $V_N = {P, Q} \land V_T = {a, b, c, d}$, a valid sentential would be $aP$; a valid sentence would be $ac$.

Generative Grammar and Four Types of Grammars: Parsing Techniques Notes (1)

Generative Grammar There are several views of defining a language. The computer science and formal linguistics perspective: terms definition Language a set of sentences Sentence a sequence of symbols Alphabet a set of all symbols The semantics - meaning - of a sentence is described by its tokens cooperating with its structure.