(一)
上一条款说的auto_ptr和tr1::share_ptr适合于heap-based的资源,然而并不是所有资源都是heap-based的。换句话说并不是tr1::shared_ptr 和 auto_ptr 永远适合做为资源的管理者。所以有时难免还是需要实现自己的资源管理类型。
假设Mutex类型通过lock和unlock两组函数进行互斥器的锁定和解锁,可能我们希望和auto_ptr一样...
分类:
编程语言 时间:
2014-06-19 10:22:06
阅读次数:
302
问题
删除一个字符串中连续超过一次的空格。
解决(Python)
#! /usr/bin/env python
#coding:utf-8
def del_space(string):
split_string = string.split(" ") #以空格为分割,生成list,list中如果含有空格,则该空格是连续空格中的后一个
string_list =...
分类:
其他好文 时间:
2014-06-16 11:21:52
阅读次数:
204
题目链接Problem discriptionGiven 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 t...
分类:
其他好文 时间:
2014-06-16 11:12:36
阅读次数:
192
Question:Given a stringsand a dictionary of
wordsdict, determine ifscan be segmented into a space-separated sequence of one
or more dictionary words.F...
分类:
其他好文 时间:
2014-06-16 07:32:47
阅读次数:
186
Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (i...
分类:
其他好文 时间:
2014-06-14 08:52:31
阅读次数:
265
1.mysql数据库(关系型数据库) 客户端软件:SQLyog 常用引擎:myIsam、
innoDB、 heap myisam与innoDB之间的区别: myisam适用的环境:很多count的计算;查询频繁,但插入不频繁;没有事务;
innoDB适用的环境:要求事务,查询和修改比较频繁;为什么读...
分类:
数据库 时间:
2014-06-13 17:30:07
阅读次数:
322
Linked List Cycle:Given a linked list, determine if
it has a cycle in it.Follow up:Can you solve it without using extra
space?解题分析:大致思想就是设置两个指针,一个指针每次...
分类:
其他好文 时间:
2014-06-13 14:41:54
阅读次数:
238
今天中午做的 第一次用邻接表去实现...我就写了下prim的 相比于kruskal
还是更喜欢它多一点...虽然知道prim+heap优化 可是我写不来.....对于 heap 虽然觉得它的概念很简单 但实现起来真的好伤啊..我想
对于prim的理解应该差不多了 基本上可以直接手码出来了 虽然这个很...
分类:
其他好文 时间:
2014-06-12 06:04:05
阅读次数:
369