Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Atlessc committed Aug 13, 2024
0 parents commit 394b7ee
Show file tree
Hide file tree
Showing 122 changed files with 8,068 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Algo Visualizer
24 changes: 24 additions & 0 deletions backup/1_Beginner_Algos/LinearSearch.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import {
Container,
CardContainer,
Title,
AlgoVisualizer,
CodeBlock
} from "../../Styled Components/styledComponents";

const {NameOfAlgo} = () => {
return (
<Container>
<CardContainer>
<Title>{NameOfAlgo}</Title>
<AlgoVisualizer>
</AlgoVisualizer>
<CodeBlock>
{` `}
</CodeBlock>
</CardContainer>
</Container>
);
};

export default {NameOfAlgo};
179 changes: 179 additions & 0 deletions create_component_files.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';

// Convert __filename and __dirname to ESM equivalent
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

// Define the root directory for the components
const rootDir = path.join(__dirname, 'src', 'components');

// Function to convert algorithm names to Title format (e.g., "LinearSearchAlgo" to "Linear Search Algo")
const toTitleCase = (str) => {
return str.replace(/([A-Z])/g, ' $1').trim();
};

// Define the structure based on the list
const structure = {
"1_Beginner_Algos": [
"LinearSearchAlgo",
"BubbleSortAlgo",
"BinarySearchAlgo",
"SelectionSortAlgo",
"InsertionSortAlgo",
"FibonacciSequenceIterativeAlgo",
"CountingSortAlgo",
"EuclideanAlgorithmAlgo",
"GcdLcmAlgo",
"RodCuttingAlgo"
],
"2_Intermediate_Algos": [
"MergeSortAlgo",
"QuickSortAlgo",
"DfsAlgo",
"BfsAlgo",
"KruskalAlgorithmAlgo",
"PrimAlgorithmAlgo",
"DijkstraAlgorithmAlgo",
"MatrixChainMultiplicationAlgo",
"LongestCommonSubsequenceAlgo",
"FloydWarshallAlgo",
"KmpAlgorithmAlgo",
"RabinKarpAlgorithmAlgo",
"SuffixTreeConstructionAlgo",
"TrieOperationsAlgo",
"BinarySearchTreeAlgo",
"NQueensAlgo",
"SudokuSolverAlgo",
"BellmanFordAlgo",
"AStarSearchAlgo",
"EditDistanceAlgo",
"HeapSortAlgo",
"ActivitySelectionAlgo",
"JobSequencingAlgo",
"CoinChangeAlgo",
"KnapsackAlgo",
"HamiltonianPathAlgo",
"KnightsTourAlgo",
"ZAlgorithmAlgo",
"ModularExponentiationAlgo",
"LevenshteinDistanceAlgo"
],
"3_Advanced_Algos": [
"SuffixArrayConstructionAlgo",
"AvlTreeRotationsAlgo",
"RedBlackTreeAlgo",
"KruskalDisjointSetAlgo",
"MinimumSpanningTreeAlgo",
"KMeansClusteringAlgo",
"PagerankAlgorithmAlgo",
"DijkstraPriorityQueueAlgo",
"ManachersAlgorithmAlgo",
"ChineseRemainderTheoremAlgo",
"MillerRabinAlgo",
"FermatsTheoremAlgo",
"SieveOfEratosthenesAlgo",
"SegmentTreeAlgo",
"FenwickTreeAlgo",
"LowestCommonAncestorAlgo",
"SplayTreeAlgo",
"TarjanAlgorithmAlgo",
"KosarajuAlgorithmAlgo",
"JohnsonsAlgorithmAlgo",
"LongestIncreasingSubsequenceAlgo",
"FftAlgo",
"KaratsubaAlgorithmAlgo",
"SubsetSumAlgo",
"IntervalSchedulingMaximizationAlgo",
"CombinationSumAlgo",
"PermutationGenerationAlgo"
],
"4_10x_Dev_Algos": [
"NeuralNetworkBackpropagationAlgo",
"GeneticAlgorithmAlgo",
"SvmAlgo",
"RandomForestAlgo",
"PcaAlgo",
"DecisionTreeAlgo",
"NaiveBayesAlgo",
"PagerankAdvancedAlgo",
"SpfaAlgorithmAlgo",
"TarjanSccAlgo",
"AhoCorasickAlgo",
"UkkonenSuffixTreeAlgo",
"BoyerMooreAlgo",
"KmpAdvancedAlgo",
"RabinKarpHashingAlgo",
"ZAlgorithmAdvancedAlgo",
"ManachersAdvancedAlgo",
"HamiltonianPathBacktrackingAlgo",
"NQueensBacktrackingAlgo",
"SudokuSolverBacktrackingAlgo",
"RatInAMazeAlgo",
"WordBreakDpAlgo",
"EggDroppingPuzzleAlgo",
"MinimaxAlgo",
"AlphaBetaPruningAlgo",
"ConvexHullAlgo",
"GrahamScanAlgo",
"JarvisMarchAlgo",
"VoronoiDiagramsAlgo",
"FortuneAlgorithmAlgo",
"LineIntersectionAlgo",
"SimpsonsRuleAlgo",
"RungeKuttaAlgo"
]
};

// Function to generate boilerplate code
const generateBoilerplate = (algoName) => {
const algoTitleName = toTitleCase(algoName);
return `import {
Container,
CardContainer,
Title,
AlgoVisualizer,
CodeBlock
} from "../../Styled Components/styledComponents";
import React from "react";
import useStore from "../../ZustandStore";
const ${algoName} = () => {
return (
<Container>
<CardContainer>
<Title>${algoTitleName}</Title>
<AlgoVisualizer>
</AlgoVisualizer>
<CodeBlock>
{ \` \` }
</CodeBlock>
</CardContainer>
</Container>
);
};
export default ${algoName};`;
};

// Create the folders and files with boilerplate content
Object.keys(structure).forEach(folder => {
const folderPath = path.join(rootDir, folder);
if (!fs.existsSync(folderPath)) {
fs.mkdirSync(folderPath, { recursive: true });
console.log(`Created folder: ${folderPath}`);
}

structure[folder].forEach(algoName => {
const filePath = path.join(folderPath, `${algoName}.jsx`);
if (!fs.existsSync(filePath)) {
const boilerplate = generateBoilerplate(algoName);
fs.writeFileSync(filePath, boilerplate);
console.log(`Created file: ${filePath} with boilerplate content`);
}
});
});

console.log('Folders and files with boilerplate created successfully.');
38 changes: 38 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import js from '@eslint/js'
import globals from 'globals'
import react from 'eslint-plugin-react'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'

export default [
{
files: ['**/*.{js,jsx}'],
ignores: ['dist'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
ecmaVersion: 'latest',
ecmaFeatures: { jsx: true },
sourceType: 'module',
},
},
settings: { react: { version: '18.3' } },
plugins: {
react,
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...js.configs.recommended.rules,
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
...reactHooks.configs.recommended.rules,
'react/jsx-no-target-blank': 'off',
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
]
20 changes: 20 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="author" content="Web54 LLC" />
<meta name="keywords" content="algorithms, algorithm visualizer, algo, visualizer, data structures, algorithms, coding, programming" />
<meta name="description" content="An interactive visualizer for data structures and algorithms" />
<meta itemprop="name" content="Algo Visualizer" />
<meta itemprop="description" content="An interactive visualizer for data structures and algorithms" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Algo Visualizer" />
<meta property="og:description" content="An interactive visualizer for data structures and algorithms" />
<title>Algo Visualizer</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
Loading

0 comments on commit 394b7ee

Please sign in to comment.