Data Structure
文章平均质量分 56
yuanhisn
这个作者很懒,什么都没留下…
展开
-
Suffix Tree
A Suffix Tree is a data-structure that allows many problems on strings (sequences of characters) to be solved quickly. Iftxt=t1t2...ti...tn is a string, then Ti=titi+1...tn is the suffix of txt that...原创 2015-02-26 05:48:22 · 88 阅读 · 0 评论 -
Implementing HashSet in Java
Implementing HashSet in Java. public class HashSet<K> { public static class Node<K> { final K key; Node next; public Node(K key, Node next) { this.key = key; this.n...原创 2015-07-22 07:59:35 · 45 阅读 · 0 评论 -
HashMap
1,链表法。public class HashMap<K,V> { public static class Node<K,V> { K key; V value; Node next; public Node(K key, V value, Node<K, V> next)...原创 2015-07-01 05:37:36 · 47 阅读 · 0 评论 -
LeetCode 212 - Word Search II
Given a 2D board and a list of words from the dictionary, find all words in the board.Each word must be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those hor...原创 2015-06-08 23:53:53 · 61 阅读 · 0 评论 -
Data structure: insert, remove, contains, get random element, all at O(1)
From:http://stackoverflow.com/questions/5682218/data-structure-insert-remove-contains-get-random-element-all-at-o1Design a data structure that offers the following operations in O(1) time:ins...原创 2015-03-15 00:07:10 · 54 阅读 · 0 评论 -
Implement a Stack
Implement Stack in Java.public class MyStack<E> { private static class Node<E> { E value; Node<E> next; public Node(E v, Node<E> n){ value = v; next = n; }...原创 2015-07-30 11:56:40 · 79 阅读 · 0 评论