Skip to content

Commit 8fc1643

Browse files
committed
chapter 03: [Stacks]
1 parent 79abb9a commit 8fc1643

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

examples/chapter03/01-Stack.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import Stack from './../../src/js/data-structures/stack.js'; // ES2015 modules
1+
// import Stack from './../../src/js/data-structures/stack.js'; // ES2015 modules
22
// import StackArray from './../../src/js/data-structures/stack-array.js'; // ES2015 modules
33
// const Stack = require('../../dist/js/data-structures/stack'); // for node
44
// const Stack = stack; // older browsers - remove from html script import: type="module"
5+
const { Stack } = PacktDataStructuresAlgorithms;
56

67
const stack = new Stack(); // new StackArray();
78

examples/chapter03/02-BalancedSymbols.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const parenthesesChecker = PacktDataStructuresAlgorithms.parenthesesChecker;
1+
const { parenthesesChecker } = PacktDataStructuresAlgorithms;
22

33
console.log('{([])}', parenthesesChecker('{([])}')); // true
44
console.log('{{([][])}()}', parenthesesChecker('{{([][])}()}')); // true

examples/chapter03/03-DecimalToBinary.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const decimalToBinary = PacktDataStructuresAlgorithms.parenthesesChecker;
2-
const baseConverter = PacktDataStructuresAlgorithms.baseConverter;
1+
const { decimalToBinary } = PacktDataStructuresAlgorithms;
2+
const { baseConverter } = PacktDataStructuresAlgorithms;
33

44
// 233 == 11101001
55
// 2x(10x10) + 3x(10) + 3x(1)

examples/chapter03/04-TowerOfHanoi.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const hanoiStack = PacktDataStructuresAlgorithms.hanoiStack;
2-
const hanoi = PacktDataStructuresAlgorithms.hanoi;
1+
const { hanoiStack } = PacktDataStructuresAlgorithms;
2+
const { hanoi } = PacktDataStructuresAlgorithms;
33

44
console.log(hanoiStack(3));
55

0 commit comments

Comments
 (0)