- 博客(6)
- 资源 (6)
- 问答 (1)
- 收藏
- 关注
原创 C-返回字符串的函数(自动变量 静态变量 static)
#include <stdio.h>#include <stdlib.h>#include <string.h>char* getstr(int value){ //static char port_str[10] = {0}; char port_str[10] = {0}; switch(value) { case 1: ...
2019-05-21 14:16:12 505
原创 Dijkstra's algorithm-python实现
def find_lowest_cost_node(costs): lowest_cost = float("inf") lowest_cost_node = None for node in costs: cost = costs[node] if cost < lowest_cost and node not in processed: lowest_cost...
2019-05-13 00:43:24 917
原创 python-递归
1.基线条件和递归条件每个递归函数都有两部分:基线条件(base case)和递归条件(recursive case)。 递归条件指的是函数调用自己,而基线条件值得是函数不再调用自己,从而避免形成无限循环def countdown(i): print(i) if i <= 1:#基线条件 return else:#递归条件 countdown(i-1)countd...
2019-05-12 23:30:45 336
原创 广度优先搜索-python实现
题目背景:假设你经营一个芒果农场,需要寻找芒果销售商,以便将芒果卖给他。在Facebook中,你与芒果销售商有联系吗?为此,你可在朋友中查找。下面的图结构描述了你在facebook中的人脉网,与You直接的相连的是你的朋友,其他的是朋友的朋友,假定姓名以‘m’结尾的是芒果销售商。要求:实现算法找出图中的芒果供应商。使用广度优先算法来实现。假设图中朋友是一度关系,朋友的朋...
2019-05-12 16:43:53 2744
原创 Linux 网络编程--sockaddr_in
#define sockaddr_in ps_sockaddr_in #define sockaddr ps_sockaddr /** @brief BSD generic socket address structure.*///2+14=16bytesstruct ps_sockaddr ...
2019-05-06 19:09:03 241
原创 直接插入排序
直接插入排序:【算法思想】直接插入排序是一种最基本的插入排序算法,其基本操作是将第个元素插入到前面个已排好序的元素中。具体过程为:将第个元素顺次与前面的,,...,进行比较,将所有大于的元素向后移动一个位置,直到遇见一个小于或者等于的元素,此时后面必为空位置,将第个元素插入到空位置即可。#include <stdio.h>#include <stdlib.h>...
2019-05-06 18:25:14 113
unp.tar.gz
2019-07-16
TA创建的收藏夹 TA关注的收藏夹
TA关注的人