

'''simple docstring'''







import math
def  UpperCAmelCase__      ( UpperCAmelCase__,    UpperCAmelCase__ = 0,    UpperCAmelCase__ = 0			)     ->     List[str]:
       A_		   = end or len(a__			)
       for i in range(a__,    a__			):
              A_		   = i
              A_		   = array[i]
              while temp_index != start and temp_index_value < array[temp_index - 1]:
                     A_		   = array[temp_index - 1]
                     temp_index -= 1
              A_		   = temp_index_value
       return array
def  UpperCAmelCase__      ( UpperCAmelCase__,    UpperCAmelCase__,    UpperCAmelCase__			)     ->     Optional[int]:  # Max Heap
       A_		   = index
       A_		   = 2 * index + 1  # Left Node
       A_		   = 2 * index + 2  # Right Node

       if left_index < heap_size and array[largest] < array[left_index]:
              A_		   = left_index

       if right_index < heap_size and array[largest] < array[right_index]:
              A_		   = right_index

       if largest != index:
              A_		   = array[largest], array[index]
              heapify(a__,    a__,    a__			)
def  UpperCAmelCase__      ( UpperCAmelCase__			)     ->     List[Any]:
       A_		   = len(a__			)

       for i in range(n // 2,    -1,    -1			):
              heapify(a__,    a__,    a__			)

       for i in range(n - 1,    0,    -1			):
              A_		   = array[0], array[i]
              heapify(a__,    0,    a__			)

       return array
def  UpperCAmelCase__      ( UpperCAmelCase__,    UpperCAmelCase__,    UpperCAmelCase__,    UpperCAmelCase__			)     ->     Optional[Any]:



       if (array[first_index] > array[middle_index]) != (
           array[first_index] > array[last_index]
       ):
              return array[first_index]
       elif (array[middle_index] > array[first_index]) != (
           array[middle_index] > array[last_index]
       ):
              return array[middle_index]
       else:
              return array[last_index]
def  UpperCAmelCase__      ( UpperCAmelCase__,    UpperCAmelCase__,    UpperCAmelCase__,    UpperCAmelCase__			)     ->     List[str]:
       A_		   = low
       A_		   = high
       while True:
              while array[i] < pivot:
                     i += 1
              j -= 1
              while pivot < array[j]:
                     j -= 1
              if i >= j:
                     return i
              A_		   = array[j], array[i]
              i += 1
def  UpperCAmelCase__      ( UpperCAmelCase__			)     ->     Any:



       if len(a__			) == 0:
              return array
       A_		   = 2 * math.ceil(math.loga(len(a__			)			)			)
       A_		   = 16
       return intro_sort(a__,    0,    len(a__			),    a__,    a__			)
def  UpperCAmelCase__      ( UpperCAmelCase__,    UpperCAmelCase__,    UpperCAmelCase__,    UpperCAmelCase__,    UpperCAmelCase__			)     ->     Optional[Any]:



       while end - start > size_threshold:
              if max_depth == 0:
                     return heap_sort(a__			)
              max_depth -= 1
              A_		   = median_of_a(a__,    a__,    start + ((end - start) // 2) + 1,    end - 1			)
              A_		   = partition(a__,    a__,    a__,    a__			)
              intro_sort(a__,    a__,    a__,    a__,    a__			)
              A_		   = p
       return insertion_sort(a__,    a__,    a__			)


if __name__ == "__main__":
      import doctest

      doctest.testmod()

      __lowerCamelCase						    =      input('''Enter numbers separated by a comma : ''').strip()
      __lowerCamelCase						    =      [float(item) for item in user_input.split(''',''')]
      print(sort(unsorted))



'''simple docstring'''







from __future__ import annotations

import numpy as np
from numpy import floataa
from numpy.typing import NDArray
def  UpperCAmelCase__      ( UpperCAmelCase__,    UpperCAmelCase__,    UpperCAmelCase__,    UpperCAmelCase__,    )     ->     list[float]:
       A_   ,     A_		   = coefficient_matrix.shape
       A_   ,     A_		   = constant_matrix.shape

       if rowsa != colsa:
              A_		   = F'''Coefficient matrix dimensions must be nxn but received {rowsa}x{colsa}'''
              raise ValueError(UpperCAmelCase__			)

       if colsa != 1:
              A_		   = F'''Constant matrix must be nx1 but received {rowsa}x{colsa}'''
              raise ValueError(UpperCAmelCase__			)

       if rowsa != rowsa:
              A_		   = (
                  """Coefficient and constant matrices dimensions must be nxn and nx1 but """
                  F'''received {rowsa}x{colsa} and {rowsa}x{colsa}'''
              )
              raise ValueError(UpperCAmelCase__			)

       if len(UpperCAmelCase__			) != rowsa:
              A_		   = (
                  """Number of initial values must be equal to number of rows in coefficient """
                  F'''matrix but received {len(UpperCAmelCase__			)} and {rowsa}'''
              )
              raise ValueError(UpperCAmelCase__			)

       if iterations <= 0:
              raise ValueError("""Iterations must be at least 1"""			)

       A_		   = np.concatenate(
           (coefficient_matrix, constant_matrix),    axis=1			)

       A_   ,     A_		   = table.shape

       strictly_diagonally_dominant(UpperCAmelCase__			)

       # Iterates the whole matrix for given number of times
       for _ in range(UpperCAmelCase__			):
              A_		   = []
              for row in range(UpperCAmelCase__			):
                     A_		   = 0
                     for col in range(UpperCAmelCase__			):
                            if col == row:
                                   A_		   = table[row][col]
                            elif col == cols - 1:
                                   A_		   = table[row][col]
                            else:
                                   temp += (-1) * table[row][col] * init_val[col]
                     A_		   = (temp + val) / denom
                     new_val.append(UpperCAmelCase__			)
              A_		   = new_val

       return [float(UpperCAmelCase__			) for i in new_val]
def  UpperCAmelCase__      ( UpperCAmelCase__			)     ->     bool:
       A_   ,     A_		   = table.shape

       A_		   = True

       for i in range(0,    UpperCAmelCase__			):
              A_		   = 0
              for j in range(0,    cols - 1			):
                     if i == j:
                            continue
                     else:
                            total += table[i][j]

              if table[i][i] <= total:
                     raise ValueError("""Coefficient matrix is not strictly diagonally dominant"""			)

       return is_diagonally_dominant


# Test Cases
if __name__ == "__main__":
      import doctest

      doctest.testmod()
