![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
面试
melouver
这个作者很懒,什么都没留下…
展开
-
字符数组中查找给定字符串
这是一位同学的面试题。典型的DFS,唯一和以前不同的是,我改进了move的方法。#include <iostream> #include <string> #include <queue> using namespace std; bool check(const vector<vector<char> > &dict, ...原创 2018-03-23 14:29:12 · 2939 阅读 · 0 评论 -
各种基本排序算法
插入排序 稳定void insertion_sort(vector<int> &v) { for (int i = 1; i < v.size(); i++) { int tmp = v[i]; int j = i-1; while (j >= 0 && v[j] > tmp) { v[j+1] = v[...原创 2018-03-23 16:34:17 · 195 阅读 · 0 评论 -
Splay、treap、avl的实现
以下代码全部来自网络,我只是汇总了一下应对面试(sng腾讯云有问到,没答好)Splay 树 typedef struct SplayNode *Tree; typedef int ElementType; struct SplayNode { Tree parent; //该结点的父节点,方便操作 ElementType val; //结点值 Tree lchild; ...转载 2018-03-23 17:05:35 · 595 阅读 · 0 评论 -
锁的实现和使用特点
自旋锁:很少的cas指令即可实现,适用于临界区短,尝试锁的时候会占用CPU时间,不会睡眠 mutex:实现较多,会导致睡眠,使用等待队列实现原创 2018-03-24 09:10:25 · 121 阅读 · 0 评论 -
Linux 常用IPC
FIFO又称有名管道,和管道一样,是半双工的,最后一次关闭就丢弃数据。 消息队列:随内核的存在性。存在优先级,一个取,一个拿,链表或者优先队列。...原创 2018-03-24 11:32:15 · 186 阅读 · 0 评论