上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 25 下一页

2019年3月18日

小于等于给定值的最长子数组

摘要: 求数组中等于给定值的最长子数组 拓展一 一个数组中既有奇数又有偶数,求奇数和偶数个数相等的最长的子数组 将奇数记为-1,偶数记为1,题目转换为求数组中等于0的最长子数组 拓展二 阅读全文

posted @ 2019-03-18 22:45 tianzeng 阅读(263) 评论(0) 推荐(0) 编辑

大楼轮廓

摘要: Given N buildings in a x-axis,each building is a rectangle and can be represented by a triple (start, end, height),where start is the start position o 阅读全文

posted @ 2019-03-18 21:33 tianzeng 阅读(187) 评论(0) 推荐(0) 编辑

2019年3月16日

单调栈

摘要: 从栈低到栈顶元素依次减小的单调栈 从栈低到栈顶元素依次增大的单调栈 应用 阅读全文

posted @ 2019-03-16 22:55 tianzeng 阅读(125) 评论(0) 推荐(0) 编辑

Morris

摘要: Morris 阅读全文

posted @ 2019-03-16 22:52 tianzeng 阅读(269) 评论(0) 推荐(0) 编辑

bfprt

摘要: bfprt //找第k小的数 or 找第n-k大的数 #include <iostream> #include <vector> #include <algorithm> using namespace std; class Solution { public: int getMinKByBFPRT 阅读全文

posted @ 2019-03-16 22:51 tianzeng 阅读(219) 评论(0) 推荐(0) 编辑

manacher

摘要: manacher:是一个可以在O(n)的复杂度中返回字符串s中最长回文子串长度的算法。 关于: arr[i]=maxR>i?min(arr[2*id-i],maxR-i):1; 其中arr[i]是以i为中心的最长回文半径,maxR是最右侧回文半径相当于上图中mx,min的作用是(用上图来解释):计算 阅读全文

posted @ 2019-03-16 22:49 tianzeng 阅读(148) 评论(0) 推荐(0) 编辑

kmp

摘要: 在暴力匹配两个字符串时,如果匹配失败,文本串跳到刚开始匹配的下一位置,模式串跳到开头。 暴力匹配具体步骤: 如果匹配成功,则++i,++j,继续匹配下一字符; 如果匹配失败,i=i-(j-1),j=0,即i回溯,j置0(从头再来) int violentMatch(const string& s,c 阅读全文

posted @ 2019-03-16 22:42 tianzeng 阅读(189) 评论(0) 推荐(0) 编辑

2019年3月7日

c++正则表达式

摘要: basic_regex 该类封装了正则表达式的解析和编译,是正则表达式的基本类。一般有两种特化regex和wregex template<class _Elem, class _RxTraits = regex_traits<_Elem> > class basic_regex : public _ 阅读全文

posted @ 2019-03-07 22:30 tianzeng 阅读(4556) 评论(0) 推荐(0) 编辑

2019年3月3日

套接字选项——getsockopt和setsockopt

摘要: 这两个函数仅用于套接字 #include <sys/socket.h> int getsockopt(int sock, int level, int optname, void *optval, socklen_t *optlen); int setsockopt(int sock, int le 阅读全文

posted @ 2019-03-03 21:28 tianzeng 阅读(471) 评论(0) 推荐(1) 编辑

IP地址转换函数

摘要: 只适用于IPV4 inet_addr函数将用点分十进制字符串表示的IPv4地址转化为用网络字节序整数表示的IPv4地址。 失败时返回INADDR_NONE。 inet_aton函数完成和inet_addr同样的功能,但是将转化结果存储于参数inp指向的地址结构中。 成功返回1,失败返回0。 inet 阅读全文

posted @ 2019-03-03 15:41 tianzeng 阅读(943) 评论(0) 推荐(0) 编辑

上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 25 下一页

导航