Giter Site home page Giter Site logo

learn-java-dsa's Introduction

Learning Data Structures & Algorithms in Java

Data Structures

  • Enumeration
  • BitSet
  • Vector
  • Stack
  • Dictionary
  • Hashtable
  • Properties

Collection Interfaces

  • Collections Interface
  • List Interface
  • Set
  • SortedSet
  • Map
  • Map.Entry
  • SortedMap
  • Enumeration

Collection Classes

  • AbstractCollection
  • AbstractList
  • AbstractSequentialList
  • LinkedList
  • ArrayList
  • AbstractSet
  • HashSet
  • LinkedHashSet
  • TreeSet
  • AbstractMap
  • HashMap
  • TreeMap
  • WeakHashMap
  • LinkedHashMap
  • IdentityHashMap

Collection Interfaces

Set

Interface Set<E> JavaDoc

Key Info

  • A collection that contains no duplicate elements.

Collection Classes

LinkedList

HashMap

HashMap<K, V> extends AbstractMap<K, V> implements Map<K, V> Default Initial Capacity: 16, Load Factor: 0.75. JavaDoc

Key Info

  • To access a value, you must know its key.
  • Hashing is the technique of converting a large String to a small String that represents the same String. The shorter value helps in indexing and faster searches.
  • It internally uses a LinkedList to store Key:Value pairs. It contains an array of Node, a class with four fields (int hash, K key, V value, Node next).
  • They don't allow duplicate keys, but do allow duplicate values. They allow null values, but only a single null key. Likewise, multiple null values.
  • This class makes no guarantee that it's order will be maintained over time. It is 'unsynchronised', also meaning that multiple threads can access it simultaneously.

Algorithmic Complexity

  • Time Complexity: O(1) (Constant Time) for basic operations like get() and put(). Iteration over a HashMap is directly proportional to the capacity + size where the capacity is the number of buckets.
  • Performance of a HashMap is dependent on it's Initial Capacity and it's Load Factor.
    • Initial Capacity: The number of buckets in the HashMap upon instantiation.
    • Load Factor: A measure of how full the hash table is allowed to get before it's capacity is automatically rehashed. Good Explanation.

learn-java-dsa's People

Contributors

tomplum avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.