上一页 1 ··· 10 11 12 13 14

2013年3月28日

Chp9: Recursion and Dynamic Programming

摘要: A goog hint that a problem is recursive is that it can be build off sub-problems.Bottom-Up Recursion:most intuitive, we start with knowing how to solve the problem for a simple case.Up-Bottom Recursion:more complex.Dynamic programming is little more than recursion where you cache the results. A good 阅读全文

posted @ 2013-03-28 05:18 Step-BY-Step 阅读(270) 评论(0) 推荐(0) 编辑

thread and process

摘要: process是进程的意思,它代表程序的一次运行,而一个进程又是由一个以上的线程组成,thread是线程的意思。线程是最小的调度单位,进程是最小的内存分配单位。Both threads and processes are methods of parallelizing an application. However, processes are independent execution units that contain their own state information, use their own address spaces, and only interact with ea 阅读全文

posted @ 2013-03-28 02:15 Step-BY-Step 阅读(234) 评论(0) 推荐(0) 编辑

2013年3月27日

Add Two Numbers

摘要: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.Input:(2 -> 4 ->3) + (5 -> 6 -> 4)Output:7 -> 0 -> 8 1 /** 2 * Definition 阅读全文

posted @ 2013-03-27 06:39 Step-BY-Step 阅读(143) 评论(0) 推荐(0) 编辑

虚函数

摘要: 在程序中,不是通过不同的对象名去调用不懂派生层次中的同名函数, 而是通过指针调用 他们。ex, 用同一个语句“pt -> display()” , 可以调用不同派生层次中的display函数, 只需要在调用前 临时给指针变量pt赋予不同的值(指向不同的类对象)。虚函数, 基类中声明函数为虚拟的, 在派生类中才定义的函数。作用: 允许在派生类中重新定义和基类同名的函数,并且可以通过基类指针或者引用 来访问基类和派生类中的同名函数。vitual 阅读全文

posted @ 2013-03-27 03:00 Step-BY-Step 阅读(135) 评论(0) 推荐(0) 编辑

多态性

摘要: 多态性:向不同的对象发送同一个消息,不同的对象在接受的时候会产生不同的行为。(方法)分为两种:静态多态性: 通过函数的重载实现。由函数重载和运算符重载形成的多态性。(程序编译时决定调用哪个函数)------- 编译时多态 调用速度快, 效率高, 但 缺乏灵活性。动态多态性: 不在编译时确定调用哪个函数,而是在程序运行过程中才动态地确定操作所针对的对象。 通过虚函数实现。 阅读全文

posted @ 2013-03-27 02:34 Step-BY-Step 阅读(149) 评论(0) 推荐(0) 编辑

接口 和 抽象类

摘要: 引自msdn: 什么是接口? 接口是包含一组虚方法的抽象类型,其中每一种方法都有其名称、参数和返回值。接口方法不能包含任何实现,CLR允许接口可以包含事件、属性、索引器、静态方法、静态字段、静态构造函数以及常数。但是注意:C#中不能包含任何静态成员。一个类可以实现多个接口,当一个类继承某个接口时,它不仅要实现该接口定义的所有方法,还要实现该接口从其他接口中继承的所有方法。接口里面的函数必须都是虚函数。什么是抽象类? 抽象类提供多个派生类共享基类的公共定义,它既可以提供抽象方法,也可以提供非抽象方法。抽象类不能实例化,必须通过继承由派生类实现其抽象方法,因此对抽象类不能使用new关键字,也不能. 阅读全文

posted @ 2013-03-27 02:16 Step-BY-Step 阅读(231) 评论(0) 推荐(0) 编辑

面向对象的三个基本特征

摘要: 转载自:http://www.cnitblog.com/Lily/archive/2013/01/03/6860.html面向对象的三个基本特征是:封装、继承、多态。封装封装最好理解了。封装是面向对象的特征之一,是对象和类概念的主要特性。封装,也就是把客观事物封装成抽象的类,并且类可以把自己的数据和方法只让可信的类或者对象操作,对不可信的进行信息隐藏。继承面向对象编程(OOP)语言的一个主要功能就是“继承”。继承是指这样一种能力:它可以使用现有类的所有功能,并在无需重新编写原来的类的情况下对这些功能进行扩展。通过继承创建的新类称为“子类”或“派生类”。被继承的类称为“基类”、“父类”或“超类” 阅读全文

posted @ 2013-03-27 01:59 Step-BY-Step 阅读(176) 评论(0) 推荐(0) 编辑

Software interfaces in object-oriented languages

摘要: Main article:Protocol (object-oriented programming)Inobject-orientedlanguages, the term "interface" is often used to define anabstract typethat contains no data, butexposesbehaviors defined asmethods. Aclasshaving all the methods corresponding to that interface is said to implement that in 阅读全文

posted @ 2013-03-27 01:49 Step-BY-Step 阅读(138) 评论(0) 推荐(0) 编辑

2013年3月26日

Median of Two Sorted Arrays

摘要: There are two sorted arrays A and B of size m and n respectively. Find the medianof the two sorted arrays. The overall run time complexity should be O(log (m+n)).O(m + n) 解法: 1 public class Solution { 2 public double findMedianSortedArrays(int A[], int B[]) { 3 // Start typing your Java ... 阅读全文

posted @ 2013-03-26 11:48 Step-BY-Step 阅读(147) 评论(0) 推荐(0) 编辑

Two Sum

摘要: 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, where index1 must be less than index2. Please note that your returned answers (both index1 and index2) are 阅读全文

posted @ 2013-03-26 10:57 Step-BY-Step 阅读(234) 评论(0) 推荐(0) 编辑

Get Start from today

摘要: I will manage to do at least two algrithm problems from today........For each problem, considering about theTime complexity and space complexity. And try to use collabedit to write the codes.Fight On!! 阅读全文

posted @ 2013-03-26 10:32 Step-BY-Step 阅读(113) 评论(0) 推荐(0) 编辑

2013/3/25 Get start~

只有注册用户登录后才能阅读该文。 阅读全文

posted @ 2013-03-26 10:31 Step-BY-Step 阅读(0) 评论(0) 推荐(0) 编辑

上一页 1 ··· 10 11 12 13 14

导航