自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 计算机网络常见面试题

HTTP 常见状态码200 success301 permanently shifted (资源被永久转移到了其他URL)403 forbidden404 not found500 internal error (服务器内部错误)

2019-03-22 08:03:50 108

翻译 Largest Sum Contiguous Subarray

Initialize: max_so_far = 0 max_ending_here = 0Loop for each element of the array (a) max_ending_here = max_ending_here + a[i] (b) if(max_ending_here < 0) max_ending_here =...

2019-03-18 09:06:26 203

翻译 两个栈实现队列

(By making enQueue operation costly) This method makes sure that oldest entered element is always at the top of stack 1, so that deQueue operation just pops from stack1. To put the element at top of s...

2019-03-18 08:58:52 95

翻译 二分查找 biniary search 模板

class Solution {public: /** * @param nums: The integer array. * @param target: Target to find. * @return: The first position of target. Position starts from 0. */ int bina...

2019-03-14 12:22:21 358

翻译 二叉树的镜像

题目描述操作给定的二叉树,将其变换为源二叉树的镜像。输入描述:二叉树的镜像定义:源二叉树8/ 6 10/ \ / 5 7 9 11镜像二叉树8/ 10 6/ \ / 11 9 7 5// C program to convert a binary tree // to its mirror #include<stdio.h> #i...

2019-03-13 23:25:25 101

python日期操作

Python : Date & TimeGetting the current time with pythondatetimefrom datetime import datetimeWe are importing the datetime class from the datetime module. Now that we have the datetime ...

2018-02-15 23:48:49 196

原创 python itertools

count()生成无限界序列,count(start=0. step=1),实例从50开始,循环50,往文件里写入对应的值。必须手动break,否则count()会一直循环import itertoolsmyFile = open("file.txt", 'w')i = 0for x in itertools.count(50): myFile.write(str(x) ...

2018-02-15 22:28:55 124

原创 python中的文件操作

command-line arguments在命令行输入python test.py 0 1 121程序为import sysprint(sys.argv)print(len(sys.argv))输出结果["test.py", "0", "1", "121"]4如果想要移除第一个”test.py”,那么sys.argv.remove(sys.argv[...

2018-02-15 22:25:31 106

原创 判断质数

一个基本定理:如果一个数n是合数,那么它的所有因子都不超过sqrt(n)。我们可以利用这个方法判断是否是素数import mathN = int(input())if N == 1: print(False)else: flag = True # 是质数 for i in range(2, int(math.sqrt(N)) + 1, 1): ...

2018-02-15 14:20:56 160

原创 进程同步 | 介绍

从同步的角度来说,进程可以分为如下的两类:独立进程:一个进程的执行不影响其他进程的执行协同进程:一个进程的执行影响其他进程的执行进程同步问题在协同进程中被引出也是因为资源在协同进程中被分享。关键部分问题关键部分是一个一次只能被一个进程访问的代码段。关键部分包含共享的变量。共享的变量需要被同步来保持数据变量的一致性。在入口段,进程提出进入到关键部分的请求。任何一个关键部分问题的解法都必须满足3个

2017-12-03 22:28:31 166

原创 Binary Search Tree

Insertionstruct node* newNode(int new_data) { struct node* temp = (struct node*)malloc(sizeof(struct node)); temp->data = new_data; temp->left = NULL; temp->right = NULL; return

2017-11-25 23:48:31 93

翻译 opencv基础

今天凌晨1点左右的时候我破戒了。当时我又看了黄片。其实我现在感觉只要我不看黄片戒个1个月,或者至少说戒个10几天其实是没有问题的。所以现在的问题就是别再看黄了。现在我又开始学习opencv了。我大一小学期的成绩太差了。这一切都是因为我手淫导致的。

2017-11-25 23:48:06 116

翻译 java中的多线程

多线程是java的一个允许并发地执行一个程序地2到多个部分特性,以此来达到CPU地最大利用率。这种程序的每一个部分都叫线程。所以,线程(threads)也就是一个进程中许多轻量级的进程。进程可以通过两种机制来创建: 1.从Thread类继承 2实现Runnable接口从Thread类继承的方式来创建线程我们创建一个继承自java.lang.Thread的类。这个类重写了该线程类中的run()方法

2017-11-25 23:47:20 92

翻译 Stack

Expression Evaluation‘+’ ,’-’ ,’‘, ‘/’ , ‘(’ , ‘)’ , ‘%’, ‘*‘。(两个乘号为乘方,具有最高优先级)#include<bits/stdc++.h>using namespace std;struct cunchu{ long long zhi; bool mode;};struct slist{ long

2017-06-14 16:01:51 215

翻译

判断图有无环路// A C++ Program to detect cycle in a graph#include<iostream>#include <list>#include <limits.h>using namespace std;class Graph{ int V; // No. of vertices list<int> *adj; // Poi

2017-06-14 01:24:36 250

翻译 杂项 哈夫曼树

qsortDefined in header void qsort( void ptr, std::size_t count, std::size_t size, /*compare-pred/* comp ); void qsort( void ptr, std::size_t count, std::size_t size, /*c-compare-pred/* comp );Sorts

2017-06-14 00:13:22 163

翻译 Binary Tree

广义表建立二叉树struct node *Create(char *str){ //str是二叉树的广义表表示的字符串 //st是栈空间,b是新建二叉链表的根指针 struct node *St[100],*P = NULL,*b; int top = -1,k,j = 0; char ch; ch = str[j]; //初始化的二叉链为空

2017-05-02 19:59:28 165

转载 单链表

linked list

2017-04-23 01:27:00 146

空空如也

空空如也

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

TA关注的人

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