Skip to content

Commit

Permalink
Deploying to gh-pages from @ 59c0b9d 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadowMitia committed Aug 23, 2023
1 parent 1c2775f commit ac0c737
Show file tree
Hide file tree
Showing 56 changed files with 243 additions and 184 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,3 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
RUN pip install wheel matplotlib numpy coconut scons

RUN sudo sh -c 'npm install -g typescript'

3 changes: 3 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ available_languages = {
'bash',
'c',
'cpp',
'csharp',
'fortran',
'java',
'julia',
Expand All @@ -43,6 +44,7 @@ available_languages = {

languages_to_import = {
'coconut': ['coconut'],
'csharp': ['mcs'],
'go': ['go'],
'rust': ['rustc', 'cargo'],
'kotlin': ['kotlin'],
Expand Down Expand Up @@ -77,6 +79,7 @@ languages = {
'c': 'c',
'coconut': 'coco',
'cpp': 'cpp',
'csharp': 'cs',
'fortran': 'f90',
'go': 'go',
'java': 'java',
Expand Down
37 changes: 37 additions & 0 deletions builders/mcs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from SCons.Builder import Builder
import SCons.Util

class ToolMCSWarning(SCons.Warnings.SConsWarning):
pass

class MCSNotFound(ToolMCSWarning):
pass

SCons.Warnings.enableWarningClass(ToolMCSWarning)

def _detect(env):
try:
return env['mcs']
except KeyError:
pass

mcs = env.WhereIs('mcs')
if mcs:
return mcs

SCons.Warnings.warn(MCSNotFound, 'Could not find mcs executable')

def exists(env):
env.Detect('mcs')

def generate(env):
env['MCS'] = _detect(env)
env['MCSFLAGS'] = []

mcs_builder = Builder(
action='"$MCS" -out:$TARGET $MCSFLAGS $SOURCES',
src_suffix='.cs',
suffix='$PROGSUFFIX',
)

env.Append(BUILDERS={'MCS': mcs_builder})
2 changes: 1 addition & 1 deletion contents/IFS/IFS.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/approximate_counting/approximate_counting.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/barnsley/barnsley.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/bitlogic/bitlogic.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/box_muller/box_muller.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/box_muller/box_muller_rejection.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/code_reviews/code_reviewers.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/computer_graphics/computer_graphics.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/computus/computus.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/convolutions/1d/1d.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/convolutions/2d/2d.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/convolutions/convolutions.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/convolutions/multiplication/multiplication.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/cooley_tukey/cooley_tukey.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/cryptography/cryptography.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/data_compression/data_compression.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/data_structures/data_structures.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/decision_problems/decision_problems.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/domain_coloring/domain_coloring.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/euclidean_algorithm/euclidean_algorithm.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/flood_fill/flood_fill.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/gaussian_elimination/gaussian_elimination.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/gift_wrapping/gift_wrapping.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/graham_scan/graham_scan.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/how_to_contribute/how_to_contribute.html

Large diffs are not rendered by default.

29 changes: 15 additions & 14 deletions contents/huffman_encoding/code/csharp/HuffmanCoding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,25 +133,26 @@ private Node CreateTree(string input)
return nodePriorityList.Pop();
}


private void CreateDictionary(Node node, string bitString, Dictionary<char, string> localDictionary)
{
if (node.IsLeaf)
localDictionary.Add(node.Key[0], bitString);
else
{
if (node.LeftChild != null)
CreateDictionary(node.LeftChild, bitString + '0', localDictionary);
if (node.RightChild != null)
CreateDictionary(node.RightChild, bitString + '1', localDictionary);
}
}

private Dictionary<char, string> CreateDictionary(Node root)
{
// We're using a string instead of a actual bits here, since it makes the code somewhat more readable and this is an educational example.
var dictionary = new Dictionary<char, string>();
CreateDictionary(root, "", dictionary);
return dictionary;

void CreateDictionary(Node node, string bitString, Dictionary<char, string> localDictionary)
{
if (node.IsLeaf)
localDictionary.Add(node.Key[0], bitString);
else
{
if (node.LeftChild != null)
CreateDictionary(node.LeftChild, bitString + '0', localDictionary);
if (node.RightChild != null)
CreateDictionary(node.RightChild, bitString + '1', localDictionary);
}
}
}


Expand All @@ -165,4 +166,4 @@ private string CreateBitString(string input, Dictionary<char, string> dictionary
return bitString;
}
}
}
}
29 changes: 15 additions & 14 deletions contents/huffman_encoding/huffman_encoding.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/introduction/introduction.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/jarvis_march/jarvis_march.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/matrix_methods/matrix_methods.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/metropolis/metropolis.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/notation/notation.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/physics_solvers/physics_solvers.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/plotting/plotting.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/probability_distributions/distributions.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/quantum_information/quantum_information.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/quantum_systems/quantum_systems.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/split-operator_method/split-operator_method.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/stacks_and_queues/stacks_and_queues.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contents/thomas_algorithm/thomas_algorithm.html

Large diffs are not rendered by default.

64 changes: 33 additions & 31 deletions contents/tree_traversal/code/csharp/Tree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,56 +30,58 @@ private Tree(int id, int depthCount, int childrenCount)
}
}

private void DFSRecursive(Tree tree) {
Console.Write(tree.Id + " ");

foreach (var c in tree._children)
DFSRecursive(c);
}

public void DFSRecursive()
{
DFSRecursive(this);

void DFSRecursive(Tree tree)
{
Console.Write(tree.Id + " ");
}

foreach (var c in tree._children)
DFSRecursive(c);
}
private void DFSRecursivePostorder(Tree tree)
{
foreach (var c in tree._children)
DFSRecursivePostorder(c);

Console.Write(tree.Id + " ");
}

public void DFSRecursivePostorder()
{
DFSRecursivePostorder(this);

void DFSRecursivePostorder(Tree tree)
{
foreach (var c in tree._children)
DFSRecursivePostorder(c);
}

Console.Write(tree.Id + " ");
private void DFSRecursiveInorderBinary(Tree tree)
{
switch (tree._children.Count)
{
case 2:
DFSRecursiveInorderBinary(tree._children[0]);
Console.Write(tree.Id + " ");
DFSRecursiveInorderBinary(tree._children[1]);
break;
case 1:
DFSRecursiveInorderBinary(tree._children[0]);
Console.Write(tree.Id + " ");
break;
case 0:
Console.Write(tree.Id + " ");
break;
default:
throw new Exception("Not binary tree!");
}
}

public void DFSRecursiveInorderBinary()
{
DFSRecursiveInorderBinary(this);

void DFSRecursiveInorderBinary(Tree tree)
{
switch (tree._children.Count)
{
case 2:
DFSRecursiveInorderBinary(tree._children[0]);
Console.Write(tree.Id + " ");
DFSRecursiveInorderBinary(tree._children[1]);
break;
case 1:
DFSRecursiveInorderBinary(tree._children[0]);
Console.Write(tree.Id + " ");
break;
case 0:
Console.Write(tree.Id + " ");
break;
default:
throw new Exception("Not binary tree!");
}
}
}

public void DFSStack()
Expand Down

0 comments on commit ac0c737

Please sign in to comment.