-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move data structs to a separate dir and create algorithms dir
Signed-off-by: Darko Draskovic <[email protected]>
- Loading branch information
1 parent
4fb4f55
commit c4eaae7
Showing
11 changed files
with
20 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// 1. identify base case | ||
// 2. identify recursion case | ||
// 3. usually, there are 2 returns, one for each case | ||
// function gets closer and closers to the base case | ||
function inception(counter) { | ||
if (counter < 0) { | ||
return 'done'; | ||
} | ||
return inception(--counter); | ||
} | ||
|
||
export function test() { | ||
console.log(inception(3)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { test } from './graph.js' | ||
import { test } from './algorithms/recursion.js' | ||
|
||
test(); |