会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
idella
博客园
首页
新随笔
联系
订阅
管理
2020年9月23日
归并排序
摘要: 归并排序,是创建在归并操作上的一种有效的排序算法。算法是采用分治法(Divide and Conquer)的一个非常典型的应用,且各层分治递归可以同时进行。归并排序思路简单,速度仅次于快速排序,为稳定排序算法,一般用于对总体无序,但是各子项相对有序的数列。 按照分治三步法,对归并排序算法介绍如下:
阅读全文
posted @ 2020-09-23 14:04 idella
阅读(167)
评论(0)
推荐(0)
2020年8月29日
二分查找训练
摘要: 二分查找训练 题目一:2020.08.29 [003] 魔术索引 1.题目描述 在数组A[0...n-1]中,有所谓的魔术索引,满足条件 A[i] = i 。给定一个有序整数数组,编写一种方法找出魔术索引,若有的话,在数组A中找出一个魔术索引,如果没有,则返回-1。若有多个魔术索引,返回索引值最小的
阅读全文
posted @ 2020-08-29 18:29 idella
阅读(332)
评论(0)
推荐(0)
2020年8月27日
LeetCode Start
摘要: LeetCode Start 由于想要提升自己的编程技巧和算法基础,为将来找工作做准备,所以现在开始每天至少刷一道题,请组织上监督我! 1. 如何高效地在LeetCode上面刷题 1.1 先用伪代码写出逻辑,再补全小段代码 力扣上面的Easy题分为两种,一种是不需要算法逻辑,只需要按照题目描述敲代码
阅读全文
posted @ 2020-08-27 21:02 idella
阅读(129)
评论(0)
推荐(0)
2020年8月24日
Genetic Algorithms with python 学习笔记ch10
摘要: Solving Linear Equations 这个问题要我们求解线性方程组。 linearEquationTests.py 完整代码如下: import unittest import datetime import genetic import fractions import random
阅读全文
posted @ 2020-08-24 19:17 idella
阅读(196)
评论(0)
推荐(0)
2020年8月10日
Genetic Algorithms with python 学习笔记ch8
摘要: Magic Squares Magic Squares 问题要求我们计算如何使给定行数的方阵的各行、各列、各个对角线之和相同。方阵中的数字取值范围与行数 n 有关,取值为 1~n² 之间。 其中 genetic.py 的完整代码如下: import random import statistics
阅读全文
posted @ 2020-08-10 21:34 idella
阅读(160)
评论(0)
推荐(0)
2020年8月9日
Genetic Algorithms with python 学习笔记ch7
摘要: Knights Problem Knights Problem 要求使用最小数量的 knight 来攻击整个棋盘上的方块,因此棋盘至少是 3 * 4 的才能满足情况。knight能够攻击的范围如下所示。 其 genetic.py 的代码为: import random import statisti
阅读全文
posted @ 2020-08-09 12:22 idella
阅读(212)
评论(0)
推荐(0)
2020年8月6日
Genetic Algorithms with python 学习笔记ch6
摘要: Card Problem Card Problem 要求将给定的10个数1~10分成A、B两个集合,要求其中一个集合的和为36,另一个集合的乘积为360。 其中 genetic.py 完整代码修改后如下: import random import statistics import sys impo
阅读全文
posted @ 2020-08-06 16:16 idella
阅读(256)
评论(0)
推荐(0)
2020年7月31日
Genetic Algorithms with python 学习笔记ch5
摘要: 利用遗传算法解决图着色问题 我们使用4个颜色来为美国地图着色,但要确保没有相邻的州具有相同的颜色。程序实现的过程中将不过分讨论地图的表示,只需各个州之间的相邻关系简单的表示就可以了。 graphColoringTests.py 完整代码如下; import csv import unittest i
阅读全文
posted @ 2020-07-31 23:00 idella
阅读(162)
评论(0)
推荐(0)
Genetic Algorithms with python 学习笔记ch4
摘要: 八皇后问题 在一个棋盘上放置八个皇后,要求各个皇后不能互相攻击。即各个皇后不能在同一行、同一列、同一对角线。 利用GA求解该问题,其 8queensTests.py 完整代码如下: import datetime import unittest import genetic def get_fitn
阅读全文
posted @ 2020-07-31 15:35 idella
阅读(327)
评论(0)
推荐(0)
2020年7月30日
Genetic Algorithms with python 学习笔记ch3
摘要: Sorted Numbers 我们需要产生一定长度的有序数列,利用GA来求解。 1. engine 其中 genetic.py 的完整代码为: import random import statistics import sys import time def _generate_parent(le
阅读全文
posted @ 2020-07-30 16:27 idella
阅读(326)
评论(0)
推荐(0)
下一页
公告