Archives: software programming

quick sort No ratings yet.

Quick sort High level code are quite simple ( divide/conque, recursively partition the array): void quickSort(int arr[], int low, int high) {     if (low < high)     {         /* pi is partitioning index, arr[p] is now            at right place */         int pi = partition(arr, low, high);         // Separately sort elements before         // partition and after partition • Read More »


Heap and Heapsort No ratings yet.

Heap/Heapsort is not difficult to understand when you reading online articles/watching online videos, but without using it everyday, it is quite easy to forget the evil details. Here are some notes to help memorizing this. (1) Min/Max heap, is a  a Complete Binary Tree with its parent nodes smaller or greater than its two children. a A • Read More »


Go Language vs C/C++ 3/5 (2)

I have spent several days on Go. It is a little more similar to C, not C++. As it has no class concept, only structure.  Also it has pointer ( but no pointer arithmetic), interface. Also it has slice, map, go routine( for multi-thread) which make it unique. Overall it is could be a good language. Here • Read More »


What’s the difference between BNF, EBNF, ABNF, ASN.1 ? 1/5 (1)

Abstract Syntax Notation One (ASN.1) is mainly for binary protocol, it is a standard and notation that describes rules and structures for representing, encoding, transmitting, and decoding data intelecommunications and computer networking.. A good tools like asn1c can convert ASN.1 to C structure, encoder/decoder. BNF, EBNF, ABNF are for text format parsing. In terms of power, • Read More »




Bison/Yacc cheat sheet ( Parser Generator cheat sheet) 0/5 (1)

The same thing happened to bison/yacc, I googled around, and was a little surprised that I could not find a bison/yacc cheat sheet. So I made a very rudimentary one here. Bison-Yacc_cheat_sheet Please comment on how to improve it. References: https://www.gnu.org/software/bison/manual/html_node/index.html Please rate this rating



GDB cheatsheat No ratings yet.

GDB cheatsheat There is a good gdb cheatsheet at http://darkdust.net/files/GDB%20Cheat%20Sheet.pdf The output format for print, x is missing  there, somehow I think it is useful to add the output formats: x,d,u,o,t,a,f,s,z,r please see https://sourceware.org/gdb/onlinedocs/gdb/Output-Formats.html  How do we usually run gdb commands normally we compile the source code with  CPPFLAG -g ( please no -O, otherwise some code are • Read More »


std::unique_lock vs std::lock_guard No ratings yet.

The std::unique_lock class is a lot more flexible when dealing with mutex locks. It has the same interface as std::lock_guard but provides additional methods for explicitly locking and unlocking mutexes and deferring locking on construction As a general rule, std::lock_guard should be preferably used when the additional features of std::unique_lock are not needed use cases: • Read More »