contributed by < weihsinyeh >
資訊所 113
姓名:葉惟欣
學號:R13922043
作業說明
Data
please download dataset from the link below
https://drive.google.com/file/d/1B2rY6cfCD-UbxBGM24sgxk5NWDgiXg8_/view?usp=drive_link
weihsinyeh changed a month agoView mode Like 1 Bookmark
contributed by < weihsinyeh >
實驗環境
$ gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ lscpu
Architecture: x86_64
weihsinyeh changed 9 months agoView mode Like 2 Bookmark
contributed by < weihsinyeh >
第一週測驗題
測驗一
參考 Optimized QuickSort — C Implementation (Non-Recursive)以實作作者 Darel Rex Finley 想法並提出改進。
不用遞迴方式原因是,遞迴執行效率比直接使用真正的陣列慢。同時因為遞迴其實用 stack 作為 their private array,可能會 stack overflow 導致無預警的 system crashing。為了避免無預警的狀況發生,因此改設定 MAX_LEVELS 為 1000 的陣列如果到達上限就 return NO 。
Wikipedia: C language implementation of QuickSort 上的 R 每次都只移動一個,而 L 則一次移到比 pivot 大的值上面然後將與 R 交換所以此時 R 有可能比 pivot 大但是也被交換到排序較小的地方。當 L 比 R 大的時候,再將 pivot 放到 L-1 的地方。
weihsinyeh changed a year agoView mode Like 5 Bookmark
contributed by < weihsinyeh >
開發環境
$ gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ lscpu
Architecture: x86_64
weihsinyeh changed a year agoView mode Like 3 Bookmark
contributed by < weihsinyeh >
第三週測驗
測驗 1
改成版本二的原因是為了不使用 libm 的 log2,因為log 2 會導致錯誤。
Domain error: x is negative errno is set to EDOM. An invalid floating-point exception (FE_INVALID) is raised.
Pole error: x is zero errno is set to ERANGE. A divide-by-zero floating-point exception (FE_DIVBYZERO) is raised.
但這裡個錯誤如果設定好 N 不會發生。接下來是精度問題。
weihsinyeh changed a year agoView mode Like Bookmark