![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c-c++
zhwli
学习笔记
展开
-
[Leetcode-3] Longest Substring Without Repeating Characters
start_index = start_index > char_map[s[i]] ? start_index : char_map[s[i]]原创 2017-10-27 11:38:00 · 139 阅读 · 0 评论 -
[C/C++] struct和typedef
C语言中,typedef 可用来的为类取别名,例如typedef struct Student{ int a;} Stu;//声明一个student类型的变量: Stu s;或struct Student s;C++ 中struct的用法比较简单typedef struct Student{ int a;}//声明一个student类型的变量:原创 2017-10-17 14:41:06 · 175 阅读 · 0 评论 -
[Leetcode1_Two Sum]
[Leetcode1_Two Sum]Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may n原创 2017-10-22 10:22:56 · 155 阅读 · 0 评论 -
反转字符串
反转字符串: 不用临时空间 -> 异或 a^ = b, b ^ = a, a ^=a原创 2017-10-31 14:45:23 · 173 阅读 · 0 评论 -
排序算法
void sort(int A[], int k)冒泡 O(N2)O(N2)O(N^2)遍历k次数组,前者比后者大就换位置,使得每次遍历后,最大的数组往后移动至正确的位置。void bobsort(int A[], int k){ for(int i=0; i<k; i++){ for(int j=0; j<k-i-1; j++){ ...原创 2018-04-22 10:56:27 · 115 阅读 · 0 评论 -
[c/c++] new
【简单记录】new是什么?c/c++ 中用于创建对象的操作。new的作用和效果?参见这里 不使用new声明对象,该对象在栈上实现。使用new,该对象在堆上实现。 栈空间有大小限制,2M-8M。堆空间则大很多。什么时候用new?当需要动态分配内存的时候,一般用new。如果创建链表,树等类型的对象的时候。...原创 2018-04-24 09:38:45 · 308 阅读 · 0 评论 -
二叉树
数据结构struct TreeNode{ int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x){ val(x), left(NULL), right(NULL) };}前序遍历中序遍历后序遍历层次遍历void levelOrde...原创 2018-04-21 22:11:06 · 129 阅读 · 0 评论