ITeye博客

自然生活

liuzhifu123 · 共 26 篇文章

An Insight to References in C++

Introduction I choose to write about references in C++ because I feel most of the people have misconceptions about references. I got this feeling because I took many C++ interviews and I seldom get correct answers about references in C++. What is meant by references in C++? A reference is generally…

2013-01-05 13:51 · Basic Knowledge · 评论(0)

C++ 指针

Pointers We have already seen how variables are seen as memory cells that can be accessed using their identifiers. This way we did not have to care about the physical location of our data within memory, we simply used its identifier whenever we wanted to refer to our variable. The memory of your co…

2013-01-05 13:24 · Basic Knowledge · 评论(0)

回调函数

在 计算机程序设计 中, 回调函数 ,或简称回调,是指通过 函数参数 传递到其它代码的,某一块 可执行代码 的 引用 。这一设计允许了 底层 代码调用在高层定义的 子程序 。 回调的用途十分广泛。例如,假设有一个函数,其功能为读取配置文件并由文件内容设置对应的选项。若这些选项由 散列值 所标记,则让这个函数接受一个回调会使得程序设计更加灵活:函数的调用者可以使用所希望的散列算法,该算法由一个将选项名转变为散列值的回调函数实现;因此,回调允许函数调用者在运行时调整原始函数的行为。 回调的另一种用途在于处理信号或者类似物。例如一个 POSIX 程序可能在收到 SIGTERM 信号时不愿立即终止;…

2013-01-05 13:18 · Basic Knowledge · 评论(0)

iphone project note

Property Declaration Attributes You can decorate a property with attributes by using the form @property(attribute [, attribute2, ...]) . Like methods, properties are scoped to their enclosing interface declaration. For property declarations that use a comma-delimited list of variable names, the pro…

2011-11-08 16:56 · iPhone Development · 评论(0) · Objective-C · iPhone

iPhone 开发:Dictionary

Notice: This article is just a note. Here are some more important facts about NSDictionary: • Whenever you add an object to a dictionary, the dictionary retains it. Whenever you remove an object from a dictionary, the dictionary releases it. • There can only be one object for each key. Therefore, i…

2011-11-04 12:19 · iPhone Development · 评论(0) · Objective-C · Cocoa · Apple

iPhone 开发:UITableView and UITableViewController

注:本文是一份学习笔记。 UITableViewCell is a subclass of UIView, and each row in a UITableView is represented by a UITableViewCell. (Recall that a table on the iPhone can only have one column, so a row will only have one cell.) A UITableView asks its data source for the cells it should display when it is firs…

2011-10-31 17:11 · iPhone Development · 评论(0)

iPhone 开发:Notification

注:本文是一份学习笔记。 Notifications: In every application, there is an instance of NSNotificationCenter, which works like a smart bulletin board. An object can register as an observer (“Send any ‘lost dog’ notifications to me.”). When another object posts a notification (“I lost my dog.”), the notification …

2011-10-31 15:57 · iPhone Development · 评论(0)

贪心算法(Greedy Algorithms)

贪心算法 适用于最优化问题的算法往往包含一系列步骤,每一步都有一组选择。贪心算法是使所做的选择看起来是当前最佳的,期望通过所做的局部最优解来产生出一个全局最优解。贪心算法对大多数优化问题来说可以产生最优解,但并不一定总是这样的。贪心算法的两个经典例子是最小生成树算法和Dijkstra单源最短路径算法。 1贪心策略的基本内容 贪心算法是通过做一系列的选择来给出某一问题的最优解。对算法中的每一个决策点,做一个当时看起来最佳的选择。这种启发式的策略并不是总能产生最优解,但它常常能给出最优解。 一般地,根据以下步骤设计贪心算法: (1) 将优化问题转化为这样的一个问题:先做出选择,再解决剩下的一个子…

2011-10-29 13:38 · Algorithms · 评论(0)

Cocoa Touch Design Pattern - delegation(未完待续)

注:本文是一份学习笔记。 cocoa touch由苹果公司提供的软件开发api, 用于开发 iphone\ipod\ipad上的软件。也是苹果公司针对iPhone应用程序快速开发提供的一个类库。此库以一系列框架库的形式存在,支持开发人员使用用户界面元素构建图像化的事件驱动的应用程序。 Cocoa Touch 层由多个框架组成,他们为应用程序提供了核心功能。 UIKit 负责启动和结束应用程序,控制界面和多触点事件 Map Kit 提供地图的相关服务 Game Kit 创建和使用网络机制 Message UI/Adress Book UI 提供操作电子邮件和联系人的信息 A callback …

2011-10-26 17:02 · iPhone Development · 评论(0)

快速排序(QuickSort)

[size=large]QuickSort 一 Introduction 快速排序的最坏运行时间是Θ(n²);但在实践上它常常是最好的算法,因为它在平均情况下的期望运行时间是Θ(n lg n),而且隐藏在Θ(n lg n)里面的常量因子是很小的。同时,它是一种原地排序算法,在虚拟内存上也工作良好。 另外,通过随机函数可以极大降低最坏情况的出现概率。 二 算法描述 快速排序算法和归并排序一样,是一种基于分治思想(divide-and-conquer)的排序算法。以下是对数组A[p...r]中的元素进行快速排序的过程。 Divide: Partition (rearrange) the arra…

2011-10-03 14:50 · Algorithms · 评论(0)

About This Blog

Hello,everyone,welcome to my blog. This blog will focus on data structure and algorithm. When introduce an algorithm, I will describe the theory as well as an implementation in one of my familiar language. Algorithm, programing,design are the basic skills for an software engineer,so this blog will …

2011-09-30 21:45 · Others · 评论(0)