View trie.js
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
function Trie() { | |
this.children = {} | |
this.value = null | |
} | |
Trie.prototype.isLeaf = function() { | |
return Object.keys(this.children).length === 0 | |
} | |
Trie.prototype.isFree = function() { |
View fib.js
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
function fib(n) { | |
var res = {} | |
function step(t) { | |
if (res[t]) { | |
return res[t] | |
} | |
if (t <= 1) { | |
res[t] = t | |
} else { |
View binaryTree.js
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
function Node(item) { | |
this.value = item | |
this.left = null | |
this.right = null | |
} | |
function BinaryTree() { | |
this.root = null | |
} |
View queue.js
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
'use strict'; | |
function Node(item) { | |
this.value = item; | |
this.next = null; | |
} | |
function Queue() { | |
this.head = null; | |
this.tail = null; |
View stack.js
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
'use strict'; | |
function Node(item) { | |
this.value = item; | |
this.next = null; | |
} | |
function Stack() { | |
this.items = null; | |
} |
View doubleLinkedList.js
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
'use strict'; | |
function Node(v) { | |
this.value = v; | |
this.next = null; | |
this.prev = null; | |
} | |
function DoubleLinkedList() { | |
this.length = 0; |
View singleLinkedList.js
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
function Node(v) { | |
this.value = v; | |
this.next = null; | |
} | |
function LinkedList() { | |
this.length = 0; | |
this.head = null; | |
} |
View hashTable.js
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
function HashTable() { | |
var table = {}; | |
this.set = function (key, value) { | |
table[key] = value; | |
}; | |
this.get = function (key) { | |
return table[key]; | |
}; | |
this.clear = function () { | |
table = {}; |
View example_componentWithMixin.js
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
// Component | |
export default { | |
mixins: [NotificationMixin], | |
methods: { | |
okNotification() { | |
this.showNotification('OK') | |
} | |
} | |
} |
View TryToTestMe.vue
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
<template> | |
<div class="team-management"> | |
<div v-if="!hasPermission('account:write')"> | |
Please contact your team administrator. | |
</div> | |
<div v-if="hasPermission('account:write')"> | |
Team Administration | |
</div> | |
<button :disabled="!hasPermission('user:create')">Add Team Member</button> | |
<button :disabled="!hasPermission('user:delete')">Remove Team Member</button> |
NewerOlder