This file contains hidden or 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
class Node { | |
constructor(element) { | |
this.element = element; | |
this.next = null; | |
} | |
} | |
class LinkedList { | |
constructor() { | |
this.head = new Node('head'); |
This file contains hidden or 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
const swap = (array, a, b) => { | |
const temp = array[a]; | |
array[a] = array[b]; | |
array[b] = temp; | |
return array; | |
}; | |
function bubbleSort(array) { | |
const n = array.length; | |
let swapped = false; |
This file contains hidden or 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
const swap = (array, a, b) => { | |
const temp = array[a]; | |
array[a] = array[b]; | |
array[b] = temp; | |
return array; | |
}; | |
function selectionSort(array) { | |
const n = array.length; | |
This file contains hidden or 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 insertSort(array) { | |
const n = array.length; | |
// loop from second element of array to last element | |
// because first element is first element of sorted portion | |
// at the beginning | |
for (let i = 1; i < n; i++) { | |
const element = array[i]; | |
let j = i; | |
This file contains hidden or 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'; | |
import can from 'can'; | |
import template from './nav.stache!'; | |
import ViewModel from './nav.viewmodel'; | |
import './nav.less!'; | |
import './button'; | |
export default can.Component.extend({ | |
init: function(element) { |
This file contains hidden or 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
// Bonfire: Missing letters | |
// Author: @minsooshin | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-missing-letters | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function fearNotLetter(str) { | |
var start = str.charCodeAt(0); | |
var end = str.charCodeAt(str.length - 1); | |
var arr = []; | |
for (var i = start; i <= end; i++) { |
This file contains hidden or 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
// Bonfire: Arguments Optional | |
// Author: @minsooshin | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-arguments-optional | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function add() { | |
var args = Array.prototype.slice.call(arguments), | |
numberType = true; | |
args.forEach(function(val) { |
This file contains hidden or 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
// Bonfire: Everything Be True | |
// Author: @minsooshin | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-everything-be-true | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function every(collection, pre) { | |
// Is everyone being true? | |
var falsyArr = collection.filter(function(val) { | |
return !(val[pre]); | |
}); |
This file contains hidden or 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
// Bonfire: Binary Agents | |
// Author: @minsooshin | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-binary-agents | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function binaryAgent(str) { | |
var arr = str.split(' '), | |
newStr = ''; | |
arr.forEach(function(val) { | |
var sum = 0; |
This file contains hidden or 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
// Bonfire: Steamroller | |
// Author: @minsooshin | |
// Challenge: http://www.freecodecamp.com/challenges/bonfire-steamroller | |
// Learn to Code at Free Code Camp (www.freecodecamp.com) | |
function steamroller(arr) { | |
// I'm a steamroller, baby | |
function flatten(array, newArr) { | |
if (newArr === undefined) newArr = []; |
NewerOlder