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() { |
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 { |
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 | |
} |
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; |
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; | |
} |
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; |
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; | |
} |
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 = {}; |
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') | |
} | |
} | |
} |
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