Bug fixes and improvements (#1298)

* Fix is_empty() implementation in the stack and queue chapter

* Update en/CONTRIBUTING.md

* Remove "剩余" from the state definition of knapsack problem

* Sync zh and zh-hant versions

* Update the stylesheets of code tabs

* Fix quick_sort.rb

* Fix TS code

* Update chapter_paperbook

* Upload the manuscript of 0.1 section

* Fix binary_tree_dfs.rb

* Bug fixes

* Update README

* Update README

* Update README

* Update README.md

* Update README

* Sync zh and zh-hant versions

* Bug fixes
This commit is contained in:
Yudong Jin
2024-04-22 02:26:32 +08:00
committed by GitHub
parent 74f1a63e8c
commit f616dac7da
61 changed files with 1606 additions and 145 deletions
@@ -51,4 +51,4 @@ const res = subsetSumI(nums, target);
console.log(`輸入陣列 nums = ${JSON.stringify(nums)}, target = ${target}`);
console.log(`所有和等於 ${target} 的子集 res = ${JSON.stringify(res)}`);
export { };
export {};
@@ -56,4 +56,4 @@ const res = subsetSumII(nums, target);
console.log(`輸入陣列 nums = ${JSON.stringify(nums)}, target = ${target}`);
console.log(`所有和等於 ${target} 的子集 res = ${JSON.stringify(res)}`);
export { };
export {};
@@ -67,4 +67,4 @@ console.log(`尾遞迴函式的求和結果 res = ${res}`);
res = fib(n);
console.log(`費波那契數列的第 ${n} 項為 ${res}`);
export { };
export {};
@@ -91,9 +91,8 @@ class GraphAdjList {
}
}
// need to add the package @types/node contains type definitions for Node.js, npm i --save-dev @types/node
if (require.main === module) {
/* Driver Code */
/* Driver Code */
if (import.meta.url.endsWith(process.argv[1])) {
/* 初始化無向圖 */
const v0 = new Vertex(1),
v1 = new Vertex(3),
@@ -122,7 +122,7 @@ class MaxHeap {
}
/* Driver Code */
if (require.main === module) {
if (import.meta.url.endsWith(process.argv[1])) {
/* 初始化大頂堆積 */
const maxHeap = new MaxHeap([9, 8, 6, 6, 7, 5, 2, 1, 4, 3, 6, 2]);
console.log('\n輸入串列並建堆積後');
@@ -4,8 +4,8 @@
* Author: yuan0221 (yl1452491917@gmail.com)
*/
const { arrToTree } = require('../modules/TreeNode');
const { printTree } = require('../modules/PrintUtil');
import { arrToTree } from '../modules/TreeNode';
import { printTree } from '../modules/PrintUtil';
type Order = 'pre' | 'in' | 'post';
@@ -148,4 +148,4 @@ console.log('中序走訪為:' + res);
res = abt.postOrder();
console.log('後序走訪為:' + res);
export { };
export {};
@@ -79,9 +79,6 @@ function showTrunks(p: Trunk | null) {
showTrunks(p.prev);
process.stdout.write(p.str);
// ts-node to execute, we need to install type definitions for node
// solve: npm i --save-dev @types/node
// restart the vscode
}
/* 列印堆積 */
+9 -5
View File
@@ -1,8 +1,12 @@
{
"compilerOptions": {
"target": "ES6",
"module": "CommonJS",
"outDir": "out",
"sourceMap": true
}
"baseUrl": ".",
"module": "esnext",
"moduleResolution": "node",
"types": ["@types/node"],
"noEmit": true,
"target": "esnext",
},
"include": ["chapter_*/*.ts"],
"exclude": ["node_modules"]
}