Tags » Hashtable

The Python dictionary: Python's native hash table

When it comes to using data structures in your coding and development career, whether that be recreational or professional, a hash table is the most efficient way to be able to store and retrieve specific data. 512 more words

Python

[Java]Custom Hash Table class using LinkedList

Hey People,
well, its again from my College assignments, Which as always I decided to share.
This class implements hash table, Which then can be used, in any other program. 1,274 more words

Custom Hashtable

Java: Map Interface Methods and Examples

In the collection framework, a map contains values on the basis of key and value pairs. This pair is known as an entry.

Points to Remember… 1,217 more words

Java

LeetCode - Longest Substring Without Repeating Characters Solution


import java.util.HashMap;

class Solution {
static int lengthOfLongestSubstring(String s) {
HashMap index = new HashMap ();
int len = 0;
int lastOccur = 0;
int start = 0;

for (int i = 0; i < s.length(); i++){
if(index.containsKey(s.charAt(i))) {
len = Math.max(i - start, len);
lastOccur = Math.max(index.get(s.charAt(i)), lastOccur);

start = lastOccur + 1;
}
index.put(s.charAt(i), i);

}
return Math.max(len, s.length() - start);
}

public static void main(String[] args) {
System.out.println(lengthOfLongestSubstring("abba"));
}
}

Complete Search

IdentityHashMap @ Java

IdentityHashMap is a HashTable -based implementation of the Map Interface. Normal HashMap compares keys using the .equals method but Identity HashMap compares its keys using the == operator. 121 more words

Java