Matthew Chen

@Matthewchen

Joined on Nov 20, 2020

  • 建置環境 1.更新python版本 sudo add-apt-repository ppa:deadsnakes/ppa sudo apt-get update sudo apt-get install python3.10 sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1 sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 2 sudo update-alternatives --config python3 2.清空資料
     Like  Bookmark
  • 測驗 α 移除節點的程式碼: void st_remove(struct st_node **root, struct st_node *del) { if (st_right(del)) { struct st_node *least = st_first(st_right(del)); if (del == *root) *root = least;
     Like  Bookmark
  • Reference: 陳彥甫 Leetcode1234 Original code - Remove Linked List Elements I choose the Problem Remove Linked List Elements since linked-list is an ubiquitous topic in computer science so I wonder how it works in assembly. Also, I find some mistakes in his either c code or assembly. Hence, I would like to correct it and try to speedup the execution with optimizations. c++ code rewritten from 陳彥甫 ListNode* removeElements(ListNode* head, int val) { ListNode *cur = head, *prev = NULL; while (cur) { if (cur->val == val) {
     Like  Bookmark
  • RV32M is a variation of the RISC-V instruction set architecture (ISA) that is designed for faster mathematical computation and provides balance between performance and code density. It is a extension of the RV32I base ISA and includes the following subsets:Multiplication operations are significant for many applications in the domain of digital signal processing, image processing, scientific computing, and many more. Division operations are needed for some scientific computing and special purpose operations like graphics rendering, etc. SPU32 ("Small Processing Unit 32"), a compact RISC-V processor implementing the RV32I instruction set, also includes some peripherals. This project is written in Verilog and is designed to be synthesizable using the yosys. YOSYS is an opensource framework for RTL synthesis, that is translate HDL into gate-level netlist implementation. We need the Verilog/SystemVerilog simulators such as Verilator, supporting RISC-V simulation. Verilator accepts Verilog or SystemVerilog, and compiles HDL code into a much faster optimized and optionally thread-partitioned model, which is in turn wrapped inside a C++/SystemC module. Setup environment
     Like  Bookmark
  • 蟻群演算法 ACO(Ant Colony Optimization)是模擬自然界中蟻群尋找食物的仿生演算法。在螞蟻移動的過程中,不斷嘗試最短路徑,並會在走過的路上留下特殊的費洛蒙,螞蟻之間可以感知這種物質濃度。如果路徑上的費洛蒙量較高,代表走過該路徑的螞蟻較多或是最新才走過,則後續的螞蟻有較大機率亦選擇此路徑。 在旅行商人的問題中,所有路徑都嘗試的方式為$\frac{n!}{2}$,即便使用平行運算進行暴力破解也需要花費許多時間(例如:最小的作業有17個城市需要3.5568743e+14次)。利用ACO演算法,由於每一次迭代就有m隻螞蟻依照規定走完所有的城市,並傳遞下訊息,可以優化下次選擇過程,讓我們在“猜測”路徑更有效率。 調整權重參數 $\alpha$、$\beta$ 和 $\rho$ 可以改變最終結果: $\alpha$ : 決定局部資訊影響性,提高可以讓收斂速度變快,但也可能不是最佳解 $\beta$ : 距離影響決策程度,提高提高會讓選擇變得隨機 $\rho$ : 訊息揮發速度,較小的話可以保留長時間訓系進行比較(但會慢一些)
     Like  Bookmark
  • OWASP常見漏洞 開放網路軟體安全計畫,簡稱OWASP (Open Web Application Security Project)是一個開放社群、非營利性組織,其主要目標是研議協助解決網路軟體安全之標準、工具與技術文件,長期致力於協助政府或企業瞭解並改善應用程式的安全性。每年OWASP都會發佈年度十大網路弱點防護守則,美國國防部亦將此守則列為最佳的Web APP安全評估標準,在攻擊時可以從裡面找到攻擊方向。 以下為2021年的排名: Broken Access Control Cryptographic Failures Injection Insecure Design Security Misconfiguration moves Vulnerable and Outdated Components
     Like  Bookmark
  • contributed by < MatthewChen > Find Pivot Index This problem is based on LeetCode 724. Given an array of integers nums, calculate the pivot index of this array. The pivot index is the index where the sum of all the numbers strictly to the left of the index is equal to the sum of all the numbers strictly to the index's right. If the index is on the left edge of the array, then the left sum is 0 because there are no elements to the left. This also applies to the right edge of the array. Return the leftmost pivot index. If no such index exists, return -1.
     Like  Bookmark
  • contributed by < Q36091334 > Still working on... Total Hamming Distance (Leetcode 477) The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given an integer array nums, return the sum of Hamming distances between all the pairs of the integers in nums. Given integer will be 32bit
     Like  Bookmark
  • contributed by < MatthewChen > Fruits into Baskets This problem is based on LeetCode 904. Given a farm that has a single row of fruit trees arranged from left to right. You only have two baskets, and each basket can only hold a single type of fruit. Starting from any tree of your choice, you pick the fruit into your basket. There is no limit on the amount of fruit each basket can hold.
     Like  Bookmark