![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C/C++
文章平均质量分 70
czl_Serena
这个作者很懒,什么都没留下…
展开
-
leetcode 面试题27 二叉树的镜像
class Solution {public: TreeNode* mirrorTree(TreeNode* root) { if(root!=NULL){ swap(root->left, root->right); } else return NULL; mirrorTree(root->left); mirrorTree(root->right); .原创 2020-05-15 01:47:32 · 186 阅读 · 0 评论 -
leetcode 283. Move zeros
//originalclass Solution {public: void moveZeroes(vector<int>& nums) { int j=0; int temp=0; for(int i=0;i<nums.size();i++) if(nums[i]!=0){ temp=nums[i]; nums[i]=nums[j].原创 2020-05-12 15:24:33 · 194 阅读 · 0 评论 -
leetcode 面试题 16.17. Contiguous Sequence LCCI
You are given an array of integers (both positive and negative). Find the contiguous sequence with the largest sum. Return the sum.Example:Input: [-2,1,-3,4,-1,2,1,-5,4]Output: 6Explanation: [4,-1,2,1] has the largest sum 6.Follow Up:If you hav...原创 2020-05-12 15:07:14 · 219 阅读 · 0 评论 -
C++ vector vs. array
vector array others 1 template class (c++ only) built-in language construct (both c/c++) 2 dynamic arrays with list interface statically or dynamically implemen...原创 2019-08-17 02:01:46 · 205 阅读 · 0 评论 -
指针函数和函数指针
指针函数:返回值是指针的函数例如:int * func_sum(int n){ if (n < 0) { printf("error:n must be > 0\n"); exit(-1); } static int sum = 0; int *p = ∑ for (int i =...转载 2019-07-29 17:52:29 · 177 阅读 · 0 评论 -
指针数组和数组指针
指针数组:array of pointers,即用于存储指针的数组,也就是数组元素都是指针数组指针:a pointer to an array,即指向数组的指针还要注意的是他们用法的区别,下面举例说明。int* a[4] array of pointers 表示:数组a中的元素都为int型指针...转载 2019-07-29 14:51:29 · 157 阅读 · 0 评论 -
C/C++ 二维数组名和二级指针
转载:https://blog.csdn.net/wu_nan_nan/article/details/51741030#commentBox指针 1.1 一个指针包含两方面:a) 地址值;b) 所指向的数据类型。 1.2 解引用操作符(dereference operator)会根据指针当前的地址值,以及所指向的数据类型,访问一块连续的内存空间(大小由指针所指向的数据类型决定),将这块...转载 2019-07-29 14:41:59 · 283 阅读 · 0 评论 -
Project 2: I/O and Library
Implement three routines: insert, delete, and extract w/o issues when operating in the middle of a file.1. System callsopen(), lseek(), read(), write().ftruncate() to modify file size.See detail in UN...原创 2018-03-04 23:35:54 · 217 阅读 · 0 评论 -
Project 3 - A simple virus
1. real ID, effective ID, saved IDThe real UID ( ruid ) and real GID ( rgid ) identify the real owner of the process and affect the permissions for sending signals. A process without superuser privile...原创 2018-03-25 05:00:11 · 195 阅读 · 0 评论 -
基础算法回顾
#1 经典排序算法 – 插入排序Insertion sort 插入排序就是每一步都将一个待排数据按其大小插入到已经排序的数据中的适当位置,直到全部插入完毕。 插入排序方法分直接插入排序和折半插入排序两种,这里只介绍直接插入排序,折半插入排序留到“查找”内容中进行。 图1演示了对4个元素进行直接插入排序的过程,共需要(a),(b),(c)三次插入。以下代码仅供参考,原创 2017-09-08 01:04:12 · 310 阅读 · 0 评论 -
位运算判断奇偶
普通方法public static boolean isOdd(int i){ return i % 2 != 0;}位运算方法public static boolean isOdd(int i){ return (i & 1) != 0;} 位运算可以提高程序的运行效率:计算机中的数字通常用二进制补码表示——如果为正数,补码原创 2017-09-06 21:11:57 · 782 阅读 · 0 评论 -
直方图中的最大矩形
在2017CSP认证和蓝桥杯均出现问题描述:Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.原创 2017-07-19 11:22:35 · 458 阅读 · 0 评论 -
凌阳小实训
2017-7-10音乐播放器FFmpeg音视频编解码 Mplayer基于FFmpeg开源小项目 开发板2.6.35内核共享目录访问:win+R 或 映射网络驱动器mplayer移植到ubuntu的可执行sbin了ac:audio codec命令:mplayer加歌曲路径GTK+图形工具包做按钮 信号和回原创 2017-07-19 10:52:28 · 294 阅读 · 0 评论 -
Java调用vs环境下C++编写的动态链接库
一、VS下生成dll文件(代码来自博文①)MyCode.h:#ifndef _MYCODE_H_#define _MYCODE_H_#ifdef DLLDEMO1_EXPORTS#define EXPORTS_DEMO _declspec( dllexport )#else#define EXPORTS_DEMO _declspec(dllimport)#endifextern原创 2017-07-07 10:49:35 · 788 阅读 · 2 评论