摘要:
""" Functions for 2D matrix operations """ from __future__ import annotations from typing import Any def add(*matrix_s: list[list[int]]) -> list[list[ 阅读全文
摘要:
# https://www.chilimath.com/lessons/advanced-algebra/cramers-rule-with-two-variables # https://en.wikipedia.org/wiki/Cramer%27s_rule from typing impor 阅读全文
摘要:
""" 前向传播解释: https://towardsdatascience.com/forward-propagation-in-neural-networks-simplified-math-and-code-version-bbcfef6f9250 """ import math import 阅读全文
摘要:
""" 参考资料: - http://neuralnetworksanddeeplearning.com/chap2.html (反向传播) - https://en.wikipedia.org/wiki/Sigmoid_function (Sigmoid激活函数) - https://en.wik 阅读全文
摘要:
""" 摆动排序。 给定一个未排序的数组 nums,重新排列它,使得 nums[0] < nums[1] > nums[2] < nums[3]...。 例如: 如果输入的数字是 [3, 5, 2, 1, 6, 4] 一种可能的摆动排序结果是 [3, 5, 1, 6, 2, 4]。 """ def 阅读全文
摘要:
""" 树排序算法。 构建二叉搜索树,然后遍历它以获取排序后的列表。 """ from __future__ import annotations from collections.abc import Iterator from dataclasses import dataclass @data 阅读全文
摘要:
# Python程序实现鸽巢排序 # 鸽巢排序的算法 def pigeonhole_sort(a): """ >>> a = [8, 3, 2, 7, 4, 6, 8] >>> b = sorted(a) # 非破坏性排序 >>> pigeonhole_sort(a) # 破坏性排序 >>> a = 阅读全文
摘要:
""" 要运行文档测试,请执行以下命令: python -m doctest -v binary_insertion_sort.py 或 python3 -m doctest -v binary_insertion_sort.py 要进行手动测试,请运行: python binary_inserti 阅读全文
摘要:
def alternative_string_arrange(first_str: str, second_str: str) -> str: """ 返回两个字符串的交替排列。 :param first_str: 第一个字符串 :param second_str: 第二个字符串 :return: 阅读全文
摘要:
import json import requests from .fetch_github_info import AUTHENTICATED_USER_ENDPOINT, fetch_github_info def test_fetch_github_info(monkeypatch): # 定 阅读全文