Couple of Days back i started reading Java Concepts 5th Edition By Cay Horstmann.
Nice book written by Cay Horstmann.
I wanted to share few quotations from the remaining chapters.
1) A recursive computation solves a problem by using the solution of the same problem with simpler values.
2) For a recursion to terminate, there must be special cases for the simplest values.
3) A common programming error is an infinite recursion: a method calling itself over and over with no end in sight. The computer needs some amount of memory for bookkeeping for each call. After some number of calls, all memory that is available for this purpose is exhausted. Your program shuts down and reports a
"stack fault".Infinite recursion happens either because the parameter values don't get simpler or
because a special terminating case is missing. For example, suppose the getArea method computes the area of a triangle with width 0.
4) Occasionally, a recursive solution runs much slower than its iterative counterpart.However, in most cases, the recursive solution is only slightly slower.
5) In many cases, a recursive solution is easier to understand and implement correctly than an iterative solution.
6) The selection sort algorithm sorts an array by repeatedly finding the smallest element of the unsorted tail region and moving it to the front.
7) Insertion sort is an O(n2) algorithm.
8) The Arrays class implements a sorting method that you should use for your Java programs.
9) A linear search examines all values in an array until it finds a match or reaches the end.
10) A binary search locates a value in a sorted array by determining whether the value occurs in the first or second half, then repeating the search in one of the halves.
11) The sort method of the Arrays class sorts objects of classes that implement the Comparable interface.
12) When you implement the compareTo method of the Comparable interface, you must make sure that the method defines a total ordering relationship, with the following three properties:
• Antisymmetric: If a.compareTo(b) <= 0, then b.compareTo(a) >= 0
• Reflexive: a.compareTo(a) = 0
• Transitive: If a.compareTo(b) <= 0 and b.compareTo(c) <= 0, then a.compareTo(c) <= 0
13) The Collections class contains a sort method that can sort array lists.
14) A linked list consists of a number of nodes, each of which has a reference to the next node.
15) Adding and removing elements in the middle of a linked list is efficient.
16) Visiting the elements of a linked list in sequential order is efficient, but random access is not.
17) You use a list iterator to access elements inside a linked list.
18) Implementing operations that modify a linked list is challenging—you need to make sure that you update all node references correctly.
19) A stack is a collection of items with “last in first out” retrieval.
20) A queue is a collection of items with “first in first out” retrieval.
21) Sets don't have duplicates. Adding a duplicate of an element that is already present is silently ignored.
22) The HashSet and TreeSet classes both implement the Set interface.
23) A set iterator does not visit the elements in the order in which you inserted them.The set implementation rearranges the elements so that it can locate them quickly.
24) You cannot add an element to a set at an iterator position.
25) A map keeps associations between key and value objects.
26) The HashMap and TreeMap classes both implement the Map interface.
27) A hash function computes an integer value from an object.
28) A good hash function minimizes collisions—identical hash codes for different objects.
29) A hash table can be implemented as an array of buckets—sequences of nodes that hold elements with the same hash code.
30) Your hashCode method must be compatible with the equals method.
31) In a hash map, only the keys are hashed.
32) A binary tree consists of nodes, each of which has at most two child nodes.
33) All nodes in a binary search tree fulfill the property that the descendants to the left have smaller data values than the node data value, and the descendants to the right have larger data values.
34) When removing a node with only one child from a binary search tree, the child replaces the node to be removed.
35) When removing a node with two children from a binary search tree, replace it with the smallest node of the right subtree.
36) To use a tree set, the elements must be comparable.
37) When removing an element from a priority queue, the element with the highest priority is retrieved.
38) A heap is an almost complete tree in which the values of all nodes are at most as large as those of their descendants.
39) In Java, generic programming can be achieved with inheritance or with type variables.
40) A generic class has one or more type variables.
41) Type variables can be instantiated with class or interface types.
42) Type variables make generic code safer and easier to read.
43) Type variables of a generic class follow the class name and are enclosed in angle brackets.
44) Use type variables for the types of generic fields, method parameters, and return values.
About the Author
Cay Horstmann grew up in Northern Germany and attended the Christian-Albrechts-Universität in Kiel,a harbor town at the Baltic sea. I received a M.S. in computer science from Syracuse University , and a Ph.D. in mathematics from the University of Michigan in Ann Arbor. I now teach computer science at San Jose State University . In my copious spare time I write books and articles on Java and consult on internet programming.
Friday, 31 October 2008
Subscribe to:
Post Comments (Atom)
2 comments:
A method of financing a van instead of buying it outright.
The private car leasing is considered best among the
various methods available. Vehicles are rented on a daily, weekend or
weekly rate for a short period - typically not more than a few weeks.
Here is my web page - Volkswagen Car Leasing
Write more, thats all I have to say. Literally, it seems
as though you relied on the video to make your point.
You clearly know what youre talking about, why waste
your intelligence on just posting videos to your
blog when you could be giving us something informative to read?
My blog post laser cellulite treatment
Post a Comment