<jupyter_start><jupyter_text>Task  Implementing Sorting Array Function Problem Expected performanceThis function is designed to sort an array containing unique elements (from 0 to 9). The length of this array can be varied from 2 to 10. InputAn array A contains unique n-elements, whose values are integers. The length (n) of A is rangefrom 2 to 10. OutputSorted array B in ascending order. The length of array B must be the same to A. Examples* Test case 1: A = [3,0] -> B = [0,3]* Test case 2: A = [1,3,2] -> B = [1,2,3]* Test case 3: A = [5,9,1,3,7] -> B = [1,3,5,7,9]* Test case 4: A = [9,8,7,6,5,4,3,2,1] -> B = [1,2,3,4,5,6,7,8,9]* Test case 5: ...   Main Idea * Apply **OOP paradigm** to design the class with clear Api for user-friendly and easier to read in the future* Elaborating about the problem sparks me more than one algorithms in which each one optimizes for different usage context with respective trade-off. Because this is to access my coding and analysis skill, so instead just provie the most simple solution, I will implement a family of algorithms for this task and let the user to choose what suitable for their situation  Implementation* To write code for easy to use and high security, I will try to apply encapsulation, abstraction, inheritance, and polymorphism principle of OOP paradigm. * To wirte codes that easy for extend in the future,I will apply **Strategy Design Pattern** .This application design pattern will helps define a family of algorithms, put each of them into a separate class, and make their objects interchangeable.     Strategy Design Pattern Skeleton<jupyter_code>from __future__ import annotations
from abc import ABC, abstractmethod
from typing import List


class SortingArrayFunction():
    """
    The SortingArrayFunction class defines the interface of interest to clients.
    """

    def __init__(self, sorting_strategy: SortingStrategy) -> None:
        """
        The SortingArrayFunction class accepts a strategy through the constructor, but
        also provides a setter to change it at runtime.
        """

        self._strategy = sorting_strategy

    @property
    def strategy(self) -> SortingStrategy:
        """
        The SortingArrayFunction class maintains a reference to one of the Strategy objects. This
        class does not know the concrete class of a strategy. It should work
        with all strategies via the Strategy interface.
        """

        return self._strategy

    @strategy.setter
    def strategy(self, sorting_strategy: SortingStrategyegy) -> None:
        """
        Usually, the Context allows replacing a Strategy object at runtime.
        """

        self._strategy = sorting_strategy

    def sort(self, input_array: List) -> List:
        """
        The SortingArrayFunction class delegates some work to the Strategy object instead of
        implementing multiple versions of the algorithm on its own.
        """

        # ...

        print("SortingArrayFunction: Sorting data using the strategy (not sure how it'll do it)")
        sorted_array = self._strategy.do_sort(input_array)
        return sorted_array

        # ...


class SortingStrategy(ABC):
    """
    The Strategy interface declares operations common to all supported versions
    of some algorithm.

    The SortingArrayFunction class uses this interface to call the sorting algorithm defined by Concrete
    Strategies.
    """

    @abstractmethod
    def do_sort(self, data: List):
        pass<jupyter_output><empty_output><jupyter_text>Concrete Sorting Strategies Implement* Concrete Strategies implement the algorithm while following the base **SortingStrategy**interface. * The interface makes them interchangeable in the **SortingArrayFunction** Instance.* The Experiment code will picks a concrete sorting strategy and passes it to the SortingArrayFunction to use.  1. Python's built-in sorted() function<jupyter_code>class BuiltInStaregy(SortingStrategy):
    def do_sort(self, data: List) -> List:
        return sorted(data)<jupyter_output><empty_output><jupyter_text>Experiment<jupyter_code># Experiemtn of Using BuiltInStaregy algorithm 
# 
sorting_array_function = SortingArrayFunction(BuiltInStaregy())
print("Experiment: Strategy is set to BuiltInStaregy sorting.")
input_array = [1, 5, 0, 9]
sorted_array = sorting_array_function.sort(input_array)
print("input array: ", input_array)
print("sorted array",sorted_array)<jupyter_output>Experiment: Strategy is set to BuiltInStaregy sorting.
SortingArrayFunction: Sorting data using the strategy (not sure how it'll do it)
input array:  [1, 5, 0, 9]
sorted array [0, 1, 5, 9]<jupyter_text>ML based strategy<jupyter_code># need to implementation<jupyter_output><empty_output><jupyter_text>Test<jupyter_code># need to implement<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07341930116472546, 'fraction_numerical': 0.013311148086522463, 'mean_word_length': 4.004162330905307, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '381735', 'license': 'MIT', 'n_tokens_mistral': 1357, 'n_tokens_neox': 1286, 'n_words': 554, 'path': 'SortingArrayFunctionTask_1_0_0.ipynb', 'repo_name': 'DucTranVan/DeepLearningInvestigation', 'size': '4808'}