自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(93)
  • 资源 (10)
  • 收藏
  • 关注

原创 python批量修改文件

场景:一个文件夹下有01,02,...不同序号的文件夹,每个文件夹下有一个txt(例如0.25.txt,代表一个参数)。目标:将01下的txt文件用01_camera.txt代替,将参数值(0.25)写入新建的txt文件夹内,最后将原txt(0.25.txt)删除。以下python代码是3.0以上的代码:import os;def main(): rootD

2015-12-04 15:49:40 1086

原创 Binary Tree Preorder Traversal —— Leetcode

Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3].Note: Recursive soluti

2015-09-11 17:04:18 574

原创 Missing Number —— Leetcode

Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.For example,Given nums = [0, 1, 3] return 2.Note:Your algorithm shoul

2015-09-11 15:56:56 557

原创 Insertion Sort List —— Leetcode

Sort a linked list using insertion sort.链表与普通的插入排序最大的区别在于:需记录插入结点和被插入结点的前驱,以便快速插入。我的代码运行时间不是最快的:/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next

2015-09-10 15:05:44 508

原创 Reverse Words in a String —— Leetcode

Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".Update (2015-02-12):For C programmers: Try to solve it in-place 

2015-09-09 18:29:50 597

原创 Maximum Product Subarray —— Leetcode

Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4],the contiguous subarray [2,3] has the larges

2015-09-09 10:31:40 456

原创 Letter Combinations of a Phone Number —— Leetcode

Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is given below.Input:Digit st

2015-09-06 17:20:42 538

原创 3Sum —— Leetcode

Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:Elements in a triplet

2015-09-05 20:51:24 481

原创 Find Peak Element —— Leetcode

A peak element is an element that is greater than its neighbors.Given an input array where num[i] ≠ num[i+1], find a peak element and return its index.The array may contain multiple peaks, i

2015-09-05 15:46:36 443

原创 Largest Number —— Leetcode(sort的妙用)

Given a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330.Note: The result may be ve

2015-09-04 16:42:43 600

原创 Two Sum —— Leetcode

Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target, whe

2015-09-04 15:19:48 586

原创 Binary Search Tree Iterator —— Leetcode

Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Calling next() will return the next smallest number in the BST.Note: next()

2015-09-03 23:09:15 429

原创 Repeated DNA Sequences —— Leetcode(教训,重做)

All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to identify repeated sequences within the DNA.Wri

2015-09-03 21:26:11 469

原创 Container With Most Water —— Leetcode

Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Fin

2015-09-02 21:04:52 420

原创 Product of Array Except Self —— Leetcode

Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Solve it without division and in O

2015-09-02 19:47:51 403

原创 Different Ways to Add Parentheses —— Leetcode(分治思想)

Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are +, -and *.Example 1I

2015-09-02 16:22:56 746

原创 Number of Islands —— Leetcode(重要的一类题)

Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assu

2015-09-01 20:46:40 814

原创 Bitwise AND of Numbers Range

Given a range [m, n] where 0 For example, given the range [5, 7], you should return 4.你可以列出一部分连续数的二进制,也许你会发现2^i次方在其中起得作用,也许你想直接从m &到 n,然而,这并没有什么卵用,所得的结果只能是Time Limited。下面的方法,慢慢体会:class Solut

2015-09-01 16:57:39 537

原创 实现atoi——从char*到int的转换

int  a2i(const char* str);步骤:1. 判断str的第一位*str是否为'-';2.str++;3.以后转换成int;源码:int a2i(const char *s){ int sign=1; if(*s == '-') sign = -1; s++; int num=0; while(*s) { n

2015-09-01 10:13:22 731

原创 Binary Tree Paths

Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf paths are:["1->2->5", "1->3"]二话不说,上代码:

2015-08-31 21:40:28 452

原创 Longest Substring Without Repeating Characters —— Leetcode

Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. Fo

2015-08-08 15:01:23 411

原创 Kth Smallest Element in a BST —— Leetcode

Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note: You may assume k is always valid, 1 ≤ k ≤ BST's total elements.Follow up:What if the

2015-08-04 11:31:35 462

原创 多线程、IO模型、epoll杂谈

1.面向多核的服务器编程时,多线程并不如多进程,因为对于每个进程来说,资源是独立的,切换core的时候无需考虑上下文;而多线程中,每个线程共享资源,在core切换的时候,资源必须从一个core复制到另一个core才能继续运算。换句话说,在cpu多核的情况下,多线程反而不如多进程。2.浏览器开一个页面,页面中很多图片,下载每个图片开一个线程;迅雷下载的时候是把文件分片

2015-08-03 20:00:09 1187

原创 Redis服务器剖析

本文主要分析redis服务器的工作的实现原理,事件,以及redis与memcache处理高并发请求的对比。1. Redis的工作流程首先从宏观上来看一下redis如何处理一个请求,以set key value为例,分为以下4步:(1) client向server发送命令请求set key valueclient会将set key value转换成协议:*

2015-08-03 19:32:50 549

原创 Redis的简单动态字符串——Simple Dynamic String

了解完Redis基本的数据结构之后再来看对象,会发现原来是这样从下到上一步步实现的。Simple Dynamic String(简单动态字符串)(1)SDS的结构struct sdshdr { int len; //记录字符串长度,如图,len=5 int free; //记录未使用的字节数,free=5 char buf[];

2015-07-31 11:40:20 1156

原创 Binary Tree Right Side View —— Leetcode(精巧的方法,第二遍)

Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.For example:Given the following binary tree, 1

2015-05-06 21:55:56 1262

原创 Linked List Cycle —— Leetcode

Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?这题大部分刷题书上都有,定义两个指针,一个快一个慢,快的每次走两步,慢的每次走一步,如下情况为有环情况:我的代码还是挺简洁的,如下:/** * D

2015-05-05 20:15:07 483

原创 Plus One —— Leetcode

Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at the head of the list.注意点:1. insert的运用 2.

2015-05-04 16:57:48 433

原创 Add Binary —— Leetcode(重做)

Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".这题不难,从后往前;难的是如何使代码变得更简洁,参考如下代码:class Solution {public: string addBinary(s

2015-05-04 16:23:23 439

原创 Remove Duplicates from Sorted List —— Leetcode

Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.一次通过,自认为方法还是比较简洁的,关于头的定

2015-05-04 10:04:22 455

原创 Merge Sorted Array —— Leetcode

Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements fro

2015-05-03 21:15:45 428

原创 Count Primes —— Leetcode

Description:Count the number of prime numbers less than a non-negative number, nclick to show more hints.References:How Many Primes Are There?Sieve of Eratosthenes参考References第二个

2015-05-02 22:17:44 2817

原创 Symmetric Tree —— Leetcode

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4 4 3But the f

2015-05-02 16:10:05 481

原创 Same Tree —— Leetcode

Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.递归之下,简单的不能

2015-05-01 22:35:07 409

原创 Path Sum —— Leetcode

Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.For example:Given the below binary tree and sum

2015-04-29 20:28:08 463

原创 Merge Two Sorted Lists —— Leetcode(再做一遍)

Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.很简单的一道题,为什么做的时候就意识模糊了呢?另外,注意头结点解决边界条件的方法,不需要事先将链表头给he

2015-04-29 20:02:34 364

原创 Happy Number —— Leetcode

Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares

2015-04-29 15:33:34 639

原创 Isomorphic Strings —— Leetcode

Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrences of a character must be replaced with anot

2015-04-29 11:00:28 749

原创 Remove Linked List Elements —— Leetcode

Remove all elements from a linked list of integers that have value val.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --> 3 --> 4 --> 5链表操作的题目,一般在链表中,对头结点的边界操作

2015-04-29 10:24:58 756

原创 Palindrome Number —— Leetcode(再做一遍)

Determine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinking of converting the integer to string

2015-04-09 22:23:09 633

深入理解linux虚拟内存管理(中文版)

深入理解linux虚拟内存管理(中文版)扫描版

2013-04-10

Loop-free routing using diffusing computations

Abstract-A family of distributed algorithms for the dynamic computation of the shortest paths in a computer network or Memet is presented, validated, and analyzed. According to these algorithms, each node maintains a vector with its distance to every other node. Update messages from a node are sent only to its neighbors; each such message contains a dktance vector of one or more entries, and each entry specifies the length of the selected path to a network destination, as well as m indication of whether the entry constitutes an update, a query, or a reply to a previous query. The new algorithms treat the problem of distributed shortest-path routing as one of diffusing computations, which was firzt proposed by Dijkztra and Scholten. They improve on algorithms introduced previously by Chandy and Misra, JatYe and Moss, Merlin and Segatl, and the author. The new algorithms are shown to converge in finite time after an arbitrary sequence of link coat or topological changes, to be loop-free at every instan~ and to outperform all other loop-free routing algorithms previously proposed from the standpoint of the combined temporal, message, and storage complexities.

2012-05-04

Cisco IP Routing: Packet Forwarding and Intra-domain Routing Protocols

Focusing on intra-domain dynamic routing protocols this book provides an in-depth understanding of IP routing and forwarding technologies, and their implementation within Cisco routers.

2012-05-03

dynamips路由模拟软件及源码

资源包括dynamips路由模拟软件及源码,软件运行需要Winpcap

2012-04-26

泛型编程与设计新思维

永远记住,编写代码的宗旨在于简单明了,不要使用语言的冷僻特征,耍小聪明,重要的是编写你理解的代码,理解你编写的代码,这样你可能会做的更好。

2012-03-19

SQL注射技术总结文档

这是一份翻译的SQL注射技术总结文档 1、简介 2、漏洞测试 3、收集信息 4、数据类型 5、抓取密码 6、创建数据库帐号 7、MYSQL利用 8、服务名和配置 9、在注册表中找VNC密码 10、刺穿IDS认证 11、在MYSQL中使用char()欺骗 12、用注释躲避IDS认证 13、构造无引号的字符串

2012-03-19

Linux命令大全

很全的Linux命令集合,包括每个命令的功能说明、语法、补充说明、参数等,支持索引查询,很好的一本书

2012-03-15

C语言标准与实现

基本概念、P6处理器的栈、从汇编语言开始、编译链接和库、动态库简介

2012-03-15

国标软件设计文档

操作手册、测试分析报告、测试计划、概要设计说明书、开发进度月报、可行性研究报告、软件需求说明书

2012-03-15

空空如也

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

TA关注的人

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