Skip to content

kamilambert/core-algorithms

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation and Setup

Installing your dependencies from the package.json file using npm install

Usage and Examples

Factorial

Returns factorial of number passed in

let multiplyNumbers = []

for (let i = input; i > 1; i--) {
	multiplyNumbers.push(i)
}
return multiplyNumbers.reduce(function(a, b) {return a * b})
}

Factorial Testing

import { expect } from 'chai'
import factorial from '../src/factorial'

describe.only('factorial()', function(){

  it('should be a function', function(){
    expect(factorial).to.be.a('function')
  })

  it('returns factorial of number passed in', function(){
    expect(factorial(5)).to.deep.equal(120)
    expect(factorial(10)).to.deep.equal(3628800)
  })
})

Core Algorithms [Classic, Numeric, Set]

  • Artifact produced is a fork of the [core-algorithms][core-algorithms] repo.
  • Can run all tests with npm test.
  • makeChange() algorithm is implemented according to the description in algorithms.md.
  • Tests for makeChange() exist with at least 2 unit tests using valid inputs, and at least 1 unit test using invalid inputs.
  • fizzBuzz() algorithm is implemented according to the description in algorithms.md.
  • Tests for fizzBuzz() exist.
  • isPalindrome() algorithm is implemented according to the description in algorithms.md.
  • Tests for isPalindrome() exist with at least 2 unit tests using valid inputs.
  • factorial() algorithm is implemented according to the description in algorithms.md.
  • Tests for factorial() exist with at least 2 unit tests using valid inputs.
  • fibonacci() algorithm is implemented according to the description in algorithms.md.
  • Tests for fibonacci() exist with at least 2 unit tests using valid inputs, and at least 1 unit test using invalid inputs.
  • collatzConjecture() algorithm is implemented according to the description in algorithms.md.
  • Tests for collatzConjecture() exist with at least 2 unit tests using valid inputs, and at least 1 unit test using invalid inputs.
  • setUnion() algorithm is implemented according to the description in algorithms.md.
  • Tests for setUnion() exist with at least 2 unit tests using valid inputs, and at least 1 unit test using invalid inputs.
  • setIntersection() algorithm is implemented according to the description in algorithms.md.
  • Tests for setIntersection() exist with at least 2 unit tests using valid inputs, and at least 1 unit test using invalid inputs.
  • setComplement() algorithm is implemented according to the description in algorithms.md.
  • Tests for setComplement() exist with at least 2 unit tests using valid inputs, and at least 1 unit test using invalid inputs.
  • setSymmetricDifference() algorithm is implemented according to the description in algorithms.md.
  • Tests for setSymmetricDifference() exist with at least 2 unit tests using valid inputs, and at least 1 unit test using invalid inputs.
  • Repository includes a README file with basic installation and setup instructions.
  • All dependencies are properly declared in package.json.
  • All major features are added via pull requests with a clear description and concise commit messages.
  • Code uses a linter and there are no linting errors.
  • Variables, functions, files, etc. have appropriate and meaningful names.
  • Functions are small and serve a single purpose.
  • The artifact produced is properly licensed, preferably with the [MIT license][mit-license].

About

Tests and implementations for algorithms commonly used in job interviews.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%