2013年8月21日

OOP design table chair bench

摘要: abstract class material{ int weight;}class wood extends material{}class plastic extends material{}class metal extends material{}interface furniture { material getMaterial(); void setMaterial(material m);}class table implements furniture{ material mat; public material getMaterial(){ ... 阅读全文

posted @ 2013-08-21 07:06 brave_bo 阅读(218) 评论(0) 推荐(0)

oop person&body

摘要: public class person { BloodType bloodtype; enum BloodType{A,B,O}; String FirstName, LastName; String BirthDay; Body body;}abstract class part{ float weight; void setWeight(float w){ weight = w;} float getWeight(){ return weight;}}class Body{ Arm[] arms; Head head; L... 阅读全文

posted @ 2013-08-21 07:03 brave_bo 阅读(140) 评论(0) 推荐(0)

设计系统题

摘要: 给个猜词小游戏的app,显示一个合法string的anagram,要求用户一分钟内给答案,返回对错,time out之后返回所有的正确答案。dictionary作为list,已知。 (预处理dictionary,用hashtable存,key是string排序后的结果,每个slot用bst存,时间为logk)eg:给atme,正确答案包括team, mate, meat, tame 阅读全文

posted @ 2013-08-21 06:44 brave_bo 阅读(113) 评论(0) 推荐(0)

malloc free vs new delete

摘要: String * ptr_str = static_cast(3*malloc(sizeof(String)));only Allocates the memory ;String * ptr_str2 = new String[3];calls the constructure of string class;delete[]ptr;if delete ptr only delte string[0] 阅读全文

posted @ 2013-08-21 02:29 brave_bo 阅读(110) 评论(0) 推荐(0)

导航