diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..68424dd --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,29 @@ +name: ci +on: + push: + branches: + - master + - main +permissions: + contents: write +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Configure Git Credentials + run: | + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com + - uses: actions/setup-python@v5 + with: + python-version: 3.x + - run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV + - uses: actions/cache@v4 + with: + key: mkdocs-material-${{ env.cache_id }} + path: .cache + restore-keys: | + mkdocs-material- + - run: pip install mkdocs-material + - run: mkdocs gh-deploy --force \ No newline at end of file diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..9e1b027 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,20 @@ +# bin_tree - Binary Tree documentation + +## Local Compilation + +To test your changes on your computer before submission: + +1. Install Python + - On Windows, check the option to add Python to the PATH during installation. + +2. Clone the repository and open a terminal in the cloned folder. + +3. Install the necessary tools with: +```bash +pip3 install -r requirements.txt +``` + +4. Start a server that automatically compiles the changes: +```bash +mkdocs serve +``` \ No newline at end of file diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..f11b2e8 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,102 @@ +# Binary Tree Operations + +This module provides operations for manipulating binary trees. + +## Type Definition + +```ocaml +type 'a bin_tree = Nil | Node of 'a * 'a bin_tree * 'a bin_tree +``` + +Represents a binary tree where each node contains a value of type `'a` and has two child nodes. + +## Functions + +### `height` + +```ocaml +val height : 'a bin_tree -> int +``` + +Returns the height of the given binary tree. + +### `nb_leaf` + +```ocaml +val nb_leaf : 'a bin_tree -> int +``` + +Returns the number of leaves in the given binary tree. + +### `nb_internal_nodes` + +```ocaml +val nb_internal_nodes : 'a bin_tree -> int +``` + +Returns the number of internal nodes in the given binary tree. + +### `internal_nodes` + +```ocaml +val internal_nodes : 'a bin_tree -> 'a list +``` + +Returns a list of internal nodes in the given binary tree. + +### `search_node` + +```ocaml +val search_node : 'a bin_tree -> 'a -> bool +``` + +Checks if the given value exists in the binary tree. + +### `is_symmetric` + +```ocaml +val is_symmetric : 'a bin_tree -> bool +``` + +Checks if the binary tree is symmetric. + +### `is_strict` + +```ocaml +val is_strict : 'a bin_tree -> bool +``` + +Checks if the binary tree is strict. + +### `is_right_comb` + +```ocaml +val is_right_comb : 'a bin_tree -> bool +``` + +Checks if the binary tree is a right comb. + +### `is_left_comb` + +```ocaml +val is_left_comb : 'a bin_tree -> bool +``` + +Checks if the binary tree is a left comb. + +### `is_comb` + +```ocaml +val is_comb : 'a bin_tree -> bool +``` + +Checks if the binary tree is a comb. + +### `is_perfect` + +```ocaml +val is_perfect : 'a bin_tree -> bool +``` + +Checks if the binary tree is perfect. +``` diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..6ccbba9 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,28 @@ +site_name: Documentation bin_tree +repo_url: https://github.com/Ahhj93/bin_tree-docs +repo_name: Ahhj93/bin_tree-docs + +theme: + name: material + palette: + - media: "(prefers-color-scheme)" + toggle: + icon: material/link + name: Switch to light mode + - media: "(prefers-color-scheme: light)" + scheme: default + primary: indigo + accent: indigo + toggle: + icon: material/toggle-switch + name: Switch to dark mode + - media: "(prefers-color-scheme: dark)" + scheme: slate + primary: black + accent: indigo + toggle: + icon: material/toggle-switch-off + name: Switch to system preference + font: + text: Roboto + code: Roboto Mono \ No newline at end of file