Tags » Hashtable

HashTable

What is hash-table ? It is key-value data structure , it is really good for lookup data in the HashTable.

Data Stuctures

History of the Modern Python Dictionary - by Raymond Hattinger

Raymond Hattinger is one of the core Python developers whose talks I’ve featured on my blog before. And rightfully so, as Raymond’s presentations are unarguably entertaining and deeply insightful from an technical perspective. 239 more words

Python

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. 534 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,272 more words

Dinesh Solanki

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,202 more words

Collection

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