All Questions
Tagged with unit-testing algorithm
36 questions
0
votes
1
answer
145
views
Six different, concise (and hopefuly readable), sorting algorithms using ES6+ idioms, with some basic unit testing
I'm practicing js, unit testing, and algorithms, so implementing some of the common sorting algorithms and doing some basic unit testing on them seemed like a good exercise.
I'm also trying to use ...
1
vote
1
answer
182
views
Testing Depth First Search Using Pytest
I have an implementation of depth first search, which I want to test using the pytest framework.
I would be making test cases for other graph algorithms, and would ...
10
votes
2
answers
2k
views
Verhoeff check digit algorithm
A recent question on credit card validation here on Code Review, led me down a dark rabbit hole of check digit algorithms. I took a stop at the Verhoeff algorithm and tried to implement it myself.
...
5
votes
2
answers
491
views
LinkedList class implementation in Python
I was solving this problem for implementing LinkedList and ListNode classes, and Insert and <...
6
votes
1
answer
715
views
Shuntyard Javascript Calculator with unit tests
I have been writing a javascript calculator for about a few weeks. It uses a shuntyard algorithm to do order of operations. Some unit tests I have not finished yet and there is some functionality ...
9
votes
2
answers
1k
views
Implementation of Viterbi algorithm along with unit tests
Introduction to the Algorithm
A system can be in N different, unobservable states, (i.e, we never know in which state the system actually is). The system also has a finite number of possible ...
3
votes
3
answers
469
views
A tiny Java library for generating Gray codes
This library is for generating Gray codes. A Gray code over \$n\$ bits is a list of \$2^n\$ different \$n\$-bit strings subject to the following constraint: two adjacent bit string differ in only one ...
6
votes
1
answer
130
views
Benchmarking efficient inversion counting algorithms in Java
Given an array \$A = (a_1, a_2, \dots, a_n)\$, the number of inversions in \$A\$ is the number of index pairs \$i,j\$ (\$i < j\$) such that \$a_i > a_j\$. We can find the number of inversions in ...
2
votes
0
answers
678
views
A fast integer key map in Java via a van Emde Boas tree
Introduction
The following data structure is a dictionary mapping primitive int values to any value type. Basically, under the hood it is a hash table, where a ...
1
vote
1
answer
893
views
Generic trie implementation in Java
I implemented a Trie data structure in Java, to test my understanding of the concept. I tried (pun intended :) ) to follow TDD steps along the way (i.e., add first a failing test case, and implement ...
10
votes
3
answers
1k
views
indexOf Boyer-Moore String Search algorithm
This is an implementation of Boyer-Moore string search algorithm index_of for a pattern in text. I was challenged to implement it by my friend.
This Python ...
2
votes
1
answer
2k
views
Test code for custom malloc
I've been working on a custom malloc where the test code is the following.
...
4
votes
1
answer
208
views
Algorithms to find various kinds of paths in graphs
I think many here are familiar with the graph data structure. Not very long ago, I implemented as an exercise a supposedly simple Graph application that does some traversals. To note, the most complex ...
7
votes
3
answers
900
views
Nucleotide Count
I am learning Java and hence practicing it from here. The solution seems pretty trivial to me but still I would like to have a honest review which would guide me to following ideas:
Am I maintaining ...
4
votes
1
answer
1k
views
Making the Levenshtein distance code cleaner
I was writing an implementation of Levenshtein distance in Python and I found my code really ugly.
Have you any idea how to make it more elegant?
...