- 博客(11)
- 收藏
- 关注
原创 【Data Structures】 12. Hashing, HashMap and HashSet in Java
The hashCode() method in Java is implemented in the Object class.Basically, the hashCode() method provides a numeric representation of an object.hashCode method in the String class uses the follow
2016-11-27 04:04:02 187
原创 【Data Structures】 11. HashTable—Simple Implementation
HashTableInterface interface// HashTable interface that takes only positive integers.// No mapping, just keyspublic interface HashTableInterface { // Return true when the key is found. boo
2016-11-27 01:32:38 209
原创 【Data Structures】 10. Hashing—Mission Possible
Converting words to numbers, more specifically integers.Workaround 1: Open Addressing (mainly linear probing)Step size:In linearing
2016-11-26 23:59:56 185
原创 【Data Structures】 9. Recursion: calling itself again
Recursive programming has a method that call itself.However, we do not want to call the method itself recursively to infinity (infinite recursion).The condition that leads to a recursive method re
2016-11-16 11:27:23 139
原创 【Data Structures】 8. Sorting in Java—Comparable and Comparator
To sort an array or a collection of objects, we need to make sure that the objects are mutually comparable. This is supported by the Comparable interface that contains only one method:compareTo(Ob
2016-11-16 00:32:29 160
原创 【Data Structures】 7. Simple Sorting—Bubble Sort, Selection Sort, and Insertion Sort
Bubble sort1. Compare two values at a time.2. If the one on the left is bigger, swap them to BUBBLE UP the bigger value to the right.3. Move one position to the right.
2016-11-15 01:41:51 206
原创 【Data Structures】 6. Queue—Another limited data structure and FIFO
A queue is a container of objects that are inserted and removed based on FIFO (First-in First-out) principle.In the queue, there are two major operations, enqueue and dequeue.1. Enqueue means inse
2016-11-07 23:37:32 234
原创 【Data Structures】 5. Stack—A limited data structure and LIFO
A stack is a container of objects that are inserted and removed according to the last-in first-out (LIFO) principle.Simply speaking, there are two major operations.1. Push: push an item onto the t
2016-11-07 22:57:47 299
原创 【Data Structures】 4. LinkedList
LinkedList is one of the two general-purpose List implementations. In addition to some general and common methods, LinkedList in Java also offers a few methods that work with the elements at the begin
2016-11-02 10:55:40 191
原创 【Data Structures】 3. ArrayList and Binary Search
ArrayList class has many methods:add(object), add(index, object), set(index, object), get(index), remove(index), size()Initial length of new ArrayList is 10. You can also set the initial Array
2016-11-01 03:46:56 173
原创 【Data Structures】 2. Arrays and Linear Search
Arrays in JavaArrays in Java can hold primitives and references. Good for storing and accessing a sequence of data.An array in java, in terms of manipulating its data, has one method, clone(), and
2016-11-01 02:58:11 195
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人