08 2013 档案

java 核心概念题
摘要:1. What is immutable object? Can you write immutable object?for example : String.For an object to be immutable, there has to be no way to change fields, mutable or not, and to access fields that are mutable.Here is an example of a mutable object.import java.util.ArrayList;import java.util.LinkedList 阅读全文

posted @ 2013-08-22 09:29 brave_bo 阅读(311) 评论(0) 推荐(0)

OOP clothing store
摘要:Design Clothing store using OOP concepts. based on your design tell how you'll find if the store has XXL size of a particular shirt.package OOP.clothstore;import java.util.ArrayList;import java.util.Hashtable;class cloth{String brand;String barCode;Type type;Size size;enum Size{xs,s,m,l,xl,xxl}; 阅读全文

posted @ 2013-08-22 02:51 brave_bo 阅读(242) 评论(0) 推荐(0)

OOP Train & reservation system
摘要:import java.util.ArrayList;import java.util.Hashtable;class station{String stationID;}class Train{String trainID;int numOfCars;int maxCapacity;int NumOfPassenger;float price;Hashtable schedule;//time, station}public class trainReservation {//id, trainHashtable trains = new Hashtable ();float reserv. 阅读全文

posted @ 2013-08-22 02:47 brave_bo 阅读(154) 评论(0) 推荐(0)

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 阅读(221) 评论(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 阅读(141) 评论(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 阅读(116) 评论(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)

未排序寻找连续 leetcode -- Longest Consecutive Sequence
摘要:Given an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given [100, 4, 200, 1, 3, 2],The longest... 阅读全文

posted @ 2013-08-16 07:05 brave_bo 阅读(258) 评论(0) 推荐(0)

leetcode -- find the lowest common ancestor
摘要:Given a binary tree, find the lowest common ancestor of two given nodes in the tree. _______3______ / \ ___5__ _... 阅读全文

posted @ 2013-08-16 05:09 brave_bo 阅读(274) 评论(0) 推荐(0)

实现一个 linkedlist
摘要:class Link { public int data1; public double data2; public Link nextLink; //Link constructor public Link(int d1, double d2) { data1 = d1; data2 = d2; } //Print Link data public void printLink() { System.out.print("{" + data1 + ", " + data2 + "} "); }}c... 阅读全文

posted @ 2013-08-16 04:32 brave_bo 阅读(187) 评论(0) 推荐(0)

OOP 的概念
摘要:This article provides a brief description about the various Object Oriented Programming concepts.Object Oriented ProgrammingIt is a type of programming in which programmers define not only the data type of a data structure, but also the types of operations (functions) that can be applied to the data 阅读全文

posted @ 2013-08-16 03:53 brave_bo 阅读(287) 评论(0) 推荐(0)

java's static
摘要:staticvariables are shared by the entire class, not a specific instance (unlike normal member variables)staticmethods are also shared by the entire classstaticclasses are inner classes that aren’t tied to their enclosing classesstaticcan be used around a block of code in a class to specify code that 阅读全文

posted @ 2013-08-16 01:14 brave_bo 阅读(262) 评论(0) 推荐(0)

指针函数 函数指针
摘要:函数指针是指向函数的指针,指针函数还是指一个函数的返回值是一个指针(1) float(**def)[10] def是什么?(2) double*(*gh)[10] gh是什么?(3) double(*f[10])() f是什么?(4) int*((*b)[10]) b是什么?(1) def是一个指针, 指向的对象也是一个指针, 指向的指针最终指向的是10个float构成的数组.(2) gh是指针, 指向的是10个元素构成的数组, 数组的元素是double*类型的指针.(3) f是10个元素构成的数组, 每个元素是指针, 指针指向的是函数, 函数类型为无参数且返回值为double. 下面要讲的窍 阅读全文

posted @ 2013-08-15 04:14 brave_bo 阅读(260) 评论(0) 推荐(0)

stack and heap
摘要:https://www.youtube.com/watch?v=_8-ht2AKyH4 阅读全文

posted @ 2013-08-15 02:58 brave_bo 阅读(126) 评论(0) 推荐(0)

polycom onsite
摘要:// Please do the following.// 1. void push(Object o);-- add element to the top// 2. Object pop(); -- remove element from the top// 3. boolean isEmpty(); -- true/false if stack is empty// Queue q;// void enqueue(Object o); -- add to the end of the queue// Object dequeue(); -- remove from the... 阅读全文

posted @ 2013-08-15 02:52 brave_bo 阅读(211) 评论(0) 推荐(0)

battleship
摘要:import java.util.ArrayList;import java.util.Scanner;public class game { private ArrayList ship = new ArrayList(); int numGuess = 0; public static void main(String[] args){ Game game = new Game(); game.setup(); } private void setup(){ ship.add(new S... 阅读全文

posted @ 2013-08-14 06:40 brave_bo 阅读(327) 评论(0) 推荐(0)

区别 c++ vs java
摘要:Similarities and DifferencesThis list of similarities and differences is based heavily onThe Java Language Environment, A White Paperby James Gosling and Henry McGilton http://java.sun.com/doc/language_environment/ and the soon-to-be published book,Thinking in Javaby Bruce Eckel, http://www.EckelObj 阅读全文

posted @ 2013-08-13 06:08 brave_bo 阅读(299) 评论(0) 推荐(0)

一个stack 实现 queue
摘要:public class Queue { private Stack s1 = new Stack(); private Stack s2 = new Stack(); public void enqueue(Element e){ s1.push(e); return; } public Element dequeue() { if(s2.isEmpty()) { while(!s1.isEmpty()) { Element e = s1.pop();... 阅读全文

posted @ 2013-08-10 04:48 brave_bo 阅读(200) 评论(0) 推荐(0)

导航