![](https://img-blog.csdnimg.cn/20201014180756926.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
计算机基础
文章平均质量分 58
hope_worker
这个作者很懒,什么都没留下…
展开
-
算法-计算1的个数及python sort函数的多层排序
leetcode: 1356.Sort Integers by The Number of 1 Bits1. 计算数字中bit1的个数在这里,计算1 bit 的个数使用的是 减1再 bit and的方式。例如 9的二进制表示为 1001:(1)减1 后为 1000, 1001&1000 = 1000.(2)1000 减1 后为 0111, 1000&...原创 2020-04-07 07:37:11 · 265 阅读 · 0 评论 -
算法-动态规划2
记得5年前写过一篇关于动态规划的博客。最近重新学习基本算法,对动态规划有了更深入的体会。感谢慕课网上《玩转算法面试-- Leetcode真题分门别类讲解》这门课程的老师liuyubobobo,这门课真的不错。对于“背包问题”,现在可以按照自己的思路写出来代码了,虽然运行一下发现有问题,经过修改调试,最终可以完成。这样的过程,我认为比记住一些代码,然后一遍把代码写对,是要好很多了。要把动态规划的...原创 2020-04-02 08:52:37 · 128 阅读 · 0 评论 -
python learning
https://www.cnblogs.com/vipchenwei/p/7239953.html原创 2019-09-22 11:12:21 · 138 阅读 · 0 评论 -
gdb debug summary
gdb attach programgdb -p $(pidof rcpd)gdb use symbolgdb att 2271 -s cips_app.symgdb create struct params(gdb) call malloc(sizeof(dps_l1xc_info_t))(gdb) p *(dps_l1xc_info_t *)$1$3 = {sr...原创 2019-09-19 16:12:00 · 134 阅读 · 0 评论 -
报文数据的txt文件 转换成wireshark可以识别的k12文件
implement a python app which can covert hex raw packet data to k12 file.Wireshark can open the k12 file and parse the packet content.#########1.txt###########09002b00 00050020 8fca980d 81000...原创 2019-07-17 13:40:02 · 1529 阅读 · 0 评论 -
command模式(c语言实现)
2014年写过一篇实现,重读一遍《设计模式》,参考网上的一篇文章,又重新写了一遍。我体会到,c++的类在c语言里面用struct代替之后,c++的this指针可以通过传入struct本身的指针来完成。而在command模式里的Command实际上既包含了对象(pData),又包含了命令接口(exe)。#include <stdio.h>#include <...原创 2019-06-01 14:22:44 · 1482 阅读 · 0 评论 -
适配器模式(c语言实现)
在这里用c实现了类似于java的接口。#include <stdio.h>#include <stdlib.h>#include <cassert>typedef struct _Duck{ void (*fly)(struct _Duck* b); void (*quack)(struct _Duck* b);}...原创 2019-06-05 16:09:18 · 662 阅读 · 0 评论 -
算法-3个水桶8升水
问题描述: 有3个水桶的容量为8升,5升和3升。 8升水桶里面装满了水。如果利用另外两个桶,得到4升水?思路: 水桶里的水量看作是状态。倒水的动作,使得状态变迁。 遍历所有的倒水动作,得到所有的状态。 因此问题就变成,如何从初始状态(8,0,0),经过倒水动作的触发,得到最终状态(4,4,0)?利用对所有状态的分析,想到所有的状态,可以以树的形式表示。遍历状态树可以用广度,也可以用深度优先原创 2015-06-11 13:57:43 · 3343 阅读 · 0 评论 -
打印图形
char g_print_array[20][20] = {{0}};struct my_point{ int i; int j;};- (int)print_array_init:(char)c{ int i = 0; int j = 0; for (i = 0; i < 20; i++) { for (j = 0;原创 2014-05-31 07:41:40 · 677 阅读 · 0 评论 -
command模式(c 语言实现)
command 模式用于把命令调用封装起来#include #include struct command_interface{ int (*on)(void); int (*off)(void);};typedef int (*plight_method)(void);typedef int (*pcd_method)(void);//light st原创 2014-04-17 17:50:40 · 803 阅读 · 0 评论 -
state 模式(c++ 实现)
#include #define SOLD_OUT (0)#define NO_QUARTER (1)#define HAS_QUARTER (0)#define SOLD (3)class GamballMachine{ int state; int count;public :GamballMachine(int count) { this->count =原创 2014-04-21 15:45:11 · 725 阅读 · 0 评论 -
《c primer plus》
Page 342一. static 变量在C语言中static关键字有两种含义。1. 放在函数外表示文件内部可见的全局变量。2. 放在函数内表示具有代码块作用域的静态变量。#include void static_test(){ /*这条语句并不是一条执行语句,其实testVar只在程序编译时初始化一次,在函数执行时,这条语句是没有的,放在这里只是表示te原创 2013-04-03 16:34:20 · 907 阅读 · 0 评论 -
第一个服务器程序
使用Myeclipse编写了第一个jsp页面,启动Tomcat 6服务器发布项目。在局域网内使用另一台笔记本访问这个页面。返回成功。客户端和服务器端通过http建立连接。服务器返回给客户端的数据可以是HTML,XML或者json的形式。因此客户端的网络编程,就是 post/get html,XML或者json数据。服务器端web编程,最简单原创 2013-04-04 16:49:37 · 631 阅读 · 1 评论