自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(23)
  • 收藏
  • 关注

原创 LeetCode89 Gray Code 格雷码生成

1、十进制序列直接得到格雷码 参考:https://www.cnblogs.com/logic3/p/5609919.html binary num             gray code 0=000      000 = 000 ^ (000>>1) 1=001      001 = 001 ^ (001>>1) 2=010      011 = 010 ^...

2018-08-19 17:28:05 261

原创 排序

 快速排序quickSort#include <iostream>#include <vector>using namespace std;int findPivot(vector<int> &a, int lo, int hi){ int ce = (lo + hi) / 2; if (a[lo] > a[ce]) s...

2018-08-19 17:26:34 159

原创 二叉树非递归遍历

1. 堆栈实现前序遍历/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {}...

2018-08-15 23:31:48 187

原创 还原二叉树遍历序列

已知一颗二叉树后序序列为 debfca, 中序序列为dbeafc, 则先序遍历为:abdecf           a       /       \    b           c  /    \       /d     e    f -----------------------------------------------------------------...

2018-08-14 22:07:14 1492

原创 C++合法的实型常量

一般形式:12.5 指数形式:E可以大写或小写,整数部分和小数部分可以省略其一,但不能都省略。0.345E+2 == 0.345x10^2.123e-1     12.e2     1.e-3 都是合法的E5        12.     5.0e(1+4) 非法!!!  ...

2018-08-14 21:07:49 15389

原创 0/1背包问题

问题描述:给定N个物品,每个物品有一个重量W和一个价值V.你有一个能装C重量的背包.问怎么装使得所装价值最大.每个物品只有一个.参考文档:https://blog.csdn.net/liuxiao214/article/details/78565707  1. 数组长度==物品数量+1#include <iostream> #include <cstdio&...

2018-08-09 23:58:48 2099

原创 stringstream用法

#include <iostream>#include <sstream>#include <vector>#include <algorithm>#include <functional>#include <iterator>#include <utility>#include <s

2018-08-07 11:06:36 422

原创 修改BeagleBone默认登录用户

操作环境方法参考文献操作环境BeagleBone Black: Debian9.3.0方法sudo vim /etc/lightdm/lightdm.conf#修改Line 122autologin-user=yourusername.重启参考文献Auto-login straight into desktop on Debi...

2018-06-09 21:48:38 1328 1

原创 Qt 5.11.0使用gdb远程部署和调试

操作环境步骤1.安装gdb2.配置Qt Kit操作环境 PC: OS Debian9.4.0, Qt 5.11.0 BeagleBone Black: Debian 9.3.0步骤1.安装gdbPC安装GNU多架构调试器:apt-get install gdb-multiarchdevin@debian-PC:~$ ...

2018-06-08 15:38:35 4970 1

原创 Qt5.11.0交叉编译

交叉编译[TOC] 为何要交叉编译呢,参考此博客。 虚拟机VitualBox,运行Debian 9.4.0 BeagleBone Black, 运行Debian 9.3 1.PC上安装Debian工具链可以参考教程1第251~254页或教程2。教程1最终效果:root@debian-PC:/home/devin# arm-linux-gnueabihf...

2018-06-07 22:25:16 7103 3

原创 长整数相乘

#include <string>#include <iostream>#include <algorithm>using namespace std;int main(){ string s1 = ""; string s2 = ""; string product = ""; //windows Ctrl+Z 和 回车 结束输入 //..

2018-04-11 21:00:17 839 1

转载 PTA3.3 Tree Traversals Again

An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys numbered from 1 to 6) is traversed, the stac...

2018-04-09 21:30:52 172

转载 PTA3.1 树的同构

03-树1 树的同构(25 分)给定两棵树T1和T2。如果T1可以通过若干次左右孩子互换就变成T2,则我们称两棵树是“同构”的。例如图1给出的两棵树就是同构的,因为我们把其中一棵树的结点A、B、G的左右孩子互换后,就得到另外一棵树。而图2就不是同构的。图1图2现给定两棵树,请你判断它们是否是同构的。输入格式:输入给出2棵二叉树树的信息。对于每棵树,首先在一行中给出一个非负整数N (≤10),即该树...

2018-04-08 16:07:58 222

原创 DS-链表实现多项式运算

//每行第一个数表示多项式项数,后面表示系数和指数。data.txt 内容如下://4 3 4 -5 2 6 1 -2 0//3 5 20 -7 4 3 1#include <iostream>#include <fstream>#include <string>using namespace std;#define useIostream 0...

2018-03-30 22:06:15 327

原创 DS - 最大子列和

01-复杂度1 最大子列和问题(20 分)给定K个整数组成的序列{ N​1​​, N​2​​, ..., N​K​​ },“连续子列”被定义为{ N​i​​, N​i+1​​, ..., N​j​​ },其中 1≤i≤j≤K。“最大子列和”则被定义为所有连续子列元素的和中最大者。例如给定序列{ -2, 11, -4, 13, -5, -2 },其连续子列{ 11, -4, 13 }有最大的和20。...

2018-03-30 10:26:02 367

原创 结构体内存分配例子 win7-64 VS2015(32-bit)

#include <stdio.h>struct T { char a; int *d; int b; int c : 20; double e;};int main(){ T t = { 'A', NULL, 0x01020304, 0x123456, 15.0 }; printf("sizeof(T) = %d\n", sizeof(T)); prin...

2018-03-26 13:42:53 287

原创 结构体(Union)内存分配

#include <stdio.h>#include <iostream>using namespace std;union U1{ char s[9]; //偏移为0 int n; //偏移为0 double d; //偏移为0};union U2{ char s[5]; int n; double d;};int main(i...

2018-03-26 13:20:30 1072

原创 char[ ]初始化时占用字节数

int main(int argc, char *argv[]) { char a[] = "12"; //带字符串结束字符'\0' printf("a字节数为:%d\n", sizeof(a)); char b[] = { '1', '2', '3' }; printf("b字节数为:%d\n", sizeof(b)); ...

2018-03-26 12:00:30 480

原创 结构体内存对齐

#include <stdio.h>#include <iostream>typedef struct{ char a; //偏移地址0 int b; //偏移地址4 char c[3]; //偏移地址8 double d; //偏移地址16}S;int main(int argc, char *argv[]){ S s1; s1.a = ...

2018-03-26 11:56:47 111

转载 QByteArray与QString

The QByteArray class provides an array of bytes.QByteArray can be used to store both raw bytes (including '\0's) and traditional 8-bit '\0'-terminated strings. Using QByteArray is much more convenient...

2018-03-17 10:00:10 532

原创 QByteArray QString string char*相互转换

char *QByteArray::data() Returns a pointer to the data stored in the byte array. The pointer can be used to access and modify the bytes that compose the array. The data is '\0'-terminated, i.e. th...

2018-03-17 09:47:22 1674

原创 基类的protected成员可以被派生类成员访问

class A{protected: //改成private会报错: "A::numX" (已声明 所在行数 : 10) 不可访问 int numX = 100;};class B: public A{public: void assign(void) { numY = numX; } int getY(void) { return numY; }private: int ...

2018-03-14 23:09:00 5957

原创 MDK-ARM v5.23 Add Programming Algorithm

开发支持包下载地址:http://www2.keil.com/mdk5/legacy问题:JLINK下载时提示:No Algorithm found for: 08000000H - 0800120FH,如下图解决办法:原文地址在编译完代码需要下载的时候,需要选择下载算法:add flash programming algorithm,这时

2017-05-15 17:08:41 1621

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除