{"id":19912026,"url":"https://github.com/madjava/algo-malgo","last_synced_at":"2025-06-13T20:36:46.899Z","repository":{"id":44019881,"uuid":"231233098","full_name":"madjava/algo-malgo","owner":"madjava","description":"Algorithms as a Service? Why not. :)","archived":false,"fork":false,"pushed_at":"2023-01-24T01:03:44.000Z","size":1030,"stargazers_count":0,"open_issues_count":13,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-11T22:45:05.026Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/madjava.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-01T15:35:14.000Z","updated_at":"2021-01-10T17:44:35.000Z","dependencies_parsed_at":"2023-02-13T07:30:31.568Z","dependency_job_id":null,"html_url":"https://github.com/madjava/algo-malgo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madjava%2Falgo-malgo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madjava%2Falgo-malgo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madjava%2Falgo-malgo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/madjava%2Falgo-malgo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/madjava","download_url":"https://codeload.github.com/madjava/algo-malgo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241341721,"owners_count":19947104,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T21:27:56.720Z","updated_at":"2025-03-01T08:41:48.818Z","avatar_url":"https://github.com/madjava.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AlgoMalgo\n\nAlgoMalgo is a simple web service that implements a few algorithms and returns the comptuted results based provided parameters. An algorithm is a process or set of steps to accomplish a certain task.\n\nThe service hosts the following endpoints:\n\n**`GET: /info`**\n\nThis will return a list of the available solutions that the service can respond to. An example response is\n\n```json\n[\n    {\n        \"title\": \"FizzBuzz\",\n        \"solution\": \"fizzbuzz\"\n    },\n    ...\n]\n```\n\n* `title` is the name of the algorithm\n\n* `solution` is a parameter value that needed for further details on how to use the solution. In this case the `FizzBuzz` solution.\n\n## EndPoints\n\nThere are two main endpoints on this service.\n\n* `/info`\n\n* `/solution`\n\n**`GET: /info`**\n\nIs the same as `GET /` and will return a list of available algorithmic solutions and their request params in the `solution` property.\n\n**`GET: /info/:solution`**\n\n`:solution` here is a param value that must match one of the items in the `solution` property from the above returned list\ne.g. to get more info about the FizzBuzz algorithm hit `http://\u003chost\u003e:\u003cport\u003e/info/fizzbuzz`. This will provide more details and what parameters or properties the endpoint is expecting, each endpoint accomplishes one task.\n\n**`POST: /solution/:solution`**\n\nA request to this endpoint would provide a response based on the input provided. This would expect a payload with certain properties available, this information is available by a call to the corresponding endpoint on the `/info` route as described above.\n\nAny other route would return a `404` status and if a request is made without the expected property or properties a `400` Bad Request is returned with some information.\n\nAny other errors will return a `500` Internal Server Error.\n\n## Setup\n\nTo get started, after downloading or checking out the project, run\n\n```bash\nnpm install\n```\n\nfrom the project root directory, then run:\n\n```bash\nnpm start\n```\n\nThis will start an [Express](https://expressjs.com/) web service on the default port `3000`, you can start it on another port by running:\n\n```bash\nPORT=\u003cyour port number\u003e npm start\n```\n\n## Tests\n\nTo run the test suites run\n\n```bash\nnpm test\n```\n\nThis will kick of the [Jest](https://jestjs.io/) test runner and you should see some info in your terminal\n\n## The Algorithms\n\n### `FizzBuzz`\n\nThe Fizz Buzz algorithm will take in a number, and return an array of numbers from 0 to the number.\n\nIn that array, all numbers that are divisible by 3 will be replace with the word 'Fizz' and those divisible by 5 'Buzz'.\n\nThose divisible by 3 and 5 with be replace with the word 'FizzBuzz'.\n\nThe Fizz Buzz algorithm is expecting a payload with a `num` property.\n\n`POST: /solution/fizzbuzz`\n\n```json\n{ \"num\": 20 }\n```\n\nIt would respond with an array of values.\n\n### `Caeser Cipher`\n\nThe Ceaser Cipher algorithm takes in a string and a number and would shift every letter in the string by the mumber.\n\nThe Ceaser Cipher algorithm is expecting a payload with a `text` and a `num` property.\n\n`POST: /solution/ceaser-cipher`\n\n```json\n{\n    \"text\": \"The string to shift\",\n    \"num\": 2\n}\n```\n\nIt would respond with a string with each letter shifted 'num' places in the alphabet.\n\n### `Harmless Ransom Note`\n\nThe Harmless Ransom Note algorithm with take in a note and a text and determine if we have enough words in the magazine text to create our note.\n\nThe Harmless Ransom Note algorithm is expecting a payload with a `note` and `magazine` property\n\n`POST: /solution/harmless-ransom-note`\n\n```json\n{\n    \"note\": \"the note\",\n    \"magazine\": \"i'd like write a to note while the sun is up\"\n}\n```\n\nIt would respond with true if we can create our Harmless Ransom note or false other wise.\n\n### `Palindrome`\n\nThe Palindrome algorithm will take a string as a parameter and return true if the string is a Palindrome. A Palindrome is a word that is the same forward or backwords. e.g. 'race car'.\n\nThe Palindrome algorithm is expecting a payload with a `word` property\n\n`POST: /solution/palindrome`\n\n```json\n{ \"word\": \"race car\" }\n```\n\nIt would return true if it's a Palindrome or false otherwise.\n\n### `Reverse Words`\n\nThe Reversed  Words algorithm will take in a string as a parameter and reverse every word in a given string.\n\nThe Reverse Words algorithm is expecting a payload with a `word` property\n\n`POST: /solution/reverse-words`\n\n```json\n{ \"word\": \"words to reverse\" }\n```\n\nIt would respond with all the words reversed\n\n### `Binary Search`\n\nThe Binary Search algorithm will perform a binary for a given value inside of a list.\n\nThe Binary Search algorithm is expecting a payload with a `numArray` and `key` property\n\n`POST: /solution/reverse-words`\n\n```json\n{ \"numArray\": [3,4,7,3,2], \"key\": 2 }\n```\n\nIt would return true if the key exists in the list or false otherwise.\n\n### `Bubble Sort`\n\nThe Bubble Sort algorithm will perform a bubble sort on an array of numbers from least to greatest.\n\nThe Bubble Sort algorithm is expecting a payload with a `numArray` property.\n\n`POST: /solution/bubble-sort`\n\n```json\n{ \"numArray\": [2,6,8,3] }\n```\n\nIt would return a sorted array of numbers\n\n### `Factorial`\n\nThe Factorial algorithm would calculate the the product of all positive integers less than or equal to a given positive integer.\n\nThe Factorial algorithm is expecting a payload with a `num` property\n\n`POST: /solution/factorial`\n\n```json\n{ \"num\": 5 }\n```\n\nIt would return the calculated factorial value\n\n### `Merge Sort`\n\nThe Merge Sort algorithm would perform a mergesort routine on a given list of numbers sorting them least to greatest.\n\nThe Merge Sort algorithm is expecting a payload with `numArray` propery\n\nIt would return an array in sorted order.\n\n### `Mean Median Mode`\n\nThe Mean Median Mode algorithm calculates the mean. median and mode for a list of numbers provided.\n\nThe Mean Median Mode algorithm is expecting a payload with a `numArray` property\n\n`POST: /solution/factorial`\n\n```json\n{ \"numArray\": [2,5,9,23 ] }\n```\n\nIt would return an object with a mean,median and mode properties and values calculated from he `numArray` provided\n\n### `Max Stock Profit`\n\nThe Max Stock Profit algorithm takes in an array of prices as a parameter, this represents the price\nif a single stock for the day and would return the maximum possible profit that can be made based on the values provided.\n\nThe Max Stock Profit algorithm is expecting a list of price values\n\n`POST: /solution/max-stock-profit`\n\n```json\n{ \"priceArray\": [23,4,67,34] }\n```\n\nIt would return the maximum possible profit that can be made\n\n### `Reverse Array`\n\nThe Reverse Array algorithm will reverse in place the array provided as the parameter.\n\nThe Reverse Array algorithm is expecting a payload with a `numArray` property\n\n`POST: /solution/reverse-array`\n\n```json\n{ \"numArray\": [1,4,7] }\n```\n\nIt would return the array in reverse\n\n### `Two Sum`\n\nThe Two Sum algorithm would return every pair of numbers from the provided numbers array that add up to the provied sum.\n\nThe Two Sum algorithm is expecting a payload with a `numArray` and `sum` properties\n\n`POST: /solution/two-sum`\n\n```json\n{ \"numArray\": [2,5,4,3], \"sum\": 7 }\n```\n\nIt would return an array containing arrays of the pair of numbers from `numArray` that add up to the `sum` number\n\n### `Sieve Of Eratosthenes`\n\nThe Sieve of Eratosthenes algorithm would return all of the prime numbers up to a given number provided.\n\nThe Sieve of Eratosthenes algorithm is expecting a payload with a `num` property\n\n`POST: /solution/sieve-of-eratosthenes`\n\n```json\n{ \"num\": 100 }\n```\n\nIt would return a list of all prime numbers up to `num`\n\n### `Fibonacci Memoized`\n\nThe Fibonacci algorithm would return the fibonacci number at a given position provied as a parameter.\n\nThe Fibonacci algorithm is expecting a payload with a `position` property\n\n`POST: /solution/fibonacci-memoized`\n\n```json\n{ \"position\": 10 }\n```\n\nIt would return the fibonacci number at that position\n\n### `Anagrams`\n\nThe Anagram algorithm determines if two words or phrase consits of, are formed with, the same sets characters if re-arranged. e.g `cinema` and `iceman`.\n\nThe Anagram algorithm is expecting a payload with two properties `phrase1` and `phrase2`\n\n`POST: /solution/anagrams`\n\n```json\n{ \"phrase1\": \"cinema\", \"phrase2\": \"iceman\" }\n```\n\nIt would return true if both words are anagrams or false otherwise\n\n### `Number To Roman`\n\nThe Number To Roman algorithm converts a decimal number to Roman numerals. e.g `2 -\u003e II`, `16 -\u003e XVI`.\n\nThe Number To Roman is expectecting a payload with a `num` property\n\n`POST: /solution/number-to-roman`\n\n```json\n{ \"num\" : 16 }\n```\n\nIt would return the Roman numeral \"XVI\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadjava%2Falgo-malgo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmadjava%2Falgo-malgo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmadjava%2Falgo-malgo/lists"}