📝
knowledge
  • links
  • 14-Pure-Education
    • My Knowledge Wiki 🌿
      • .github
        • ISSUE_TEMPLATE
          • Question 🤔
          • bug_report
          • Feature ✨
        • Summary
      • design
        • Animation
        • Fonts
        • Framer
        • Color
        • figma
          • Figma
          • Figma plugins
        • Inkscape
        • Blender
        • Design
        • Interior Design
        • Icons
        • Design inspiration
        • 3D modeling
        • Design systems
        • Industrial Design
        • User Experience
        • Logos
      • databases
        • Neo4j
        • Fauna
        • sql
          • SQL
        • blockchain
          • Cardano
          • Arweave
          • Tezos
          • Polkadot
          • Uniswap
          • Ethereum
          • Blockchain
        • Kdb+
        • Cassandra DB
        • PostgreSQL
        • FoundationDB
        • SQLite
        • Prometheus
        • Dgraph
        • Redis
        • DynamoDB
        • Databases
        • Memcached
        • MariaDB
        • Prisma
        • MongoDB
      • augmented-reality
        • Augmented Reality
        • ARKit
      • art
        • Art
        • Pen plotting
        • Drawing
        • Photography
        • Generative art
        • Sketching
        • Comics
        • Anime
        • Furniture
        • Dancing
        • Architecture
        • Clothes
        • Tattoos
      • computer-graphics
        • computer-vision
          • Optical character recognition
          • Computer vision
        • Procedural generation
        • Metal
        • SVG
        • WebGPU
        • [Ray tracing](https://en.wikipedia.org/wiki/Ray_tracing_(graphics))
        • Computer graphics
        • WebGL
        • CUDA
        • OpenGL
        • Vulkan API
        • Bézier curves
        • Shaders
        • Image processing
        • [Rendering](https://en.wikipedia.org/wiki/Rendering_(computer_graphics))
      • computer-science
        • Parsing
        • algorithms
          • Algorithms
          • Compression
        • Computer Science
        • Computer architecture
        • formal-verification
          • Formal verification
          • TLA+
        • Automata theory
        • data-structures
          • Data structures
      • business
        • startups
          • Marketplaces
          • Funding
          • Values
          • Onboarding
          • Venture capital
          • Startups
          • Payroll
        • Products
        • Business
        • Restaurants
        • Landing pages
        • Pricing
      • compilers
        • LLVM
        • Linters
        • build-systems
          • Build systems
          • Bazel
        • Compilers
      • books
        • Mind for numbers - Review
        • Thinking, fast and slow
        • Brave new world
        • Elements of programming interviews
        • Rich dad poor dad
        • Programming in Haskell
        • Code: hidden language of software
        • Surely you are joking Mr Feynman
        • Books
        • Mindstorms
        • Eloquent ruby
        • go-in-action
        • Crafting interpreters
        • Cracking the coding interview
        • Artificial Intelligence: A Modern Approach
      • devops
        • Observability
        • DevOps
        • Site Reliability Engineering
        • Terraform
      • cryptocurrencies
        • Nano
        • Cryptocurrencies
        • Bitcoin
        • Stellar
        • Libra
        • TON
      • backups
        • Backups
      • 3d-printing
        • 3D Printing
      • distributed-systems
        • message-queue
          • Message queue
          • ZeroMQ
          • MQTT
        • [Load balancing](https://en.wikipedia.org/wiki/Load_balancing_(computing))
        • rpcs
          • gRPC
          • Remote Procedure Calls
        • Distributed systems
        • Conflict-free replicated data type
      • cli
        • Command Line Tools
        • Tmux
        • Ngrok
        • Sed
      • automation
        • Home automation
        • Automation
      • biology
        • Computational biology
        • Biology
        • Evolution
        • genomics
          • DNA
          • Genomics
        • immunology
          • Immunotherapy
          • Immunology
        • Bionics
        • bioinformatics
          • Bioinformatics
        • Viruses
      • cloud-computing
        • serverless-computing
          • AWS Lambda
          • Serverless computing
          • Cloudflare workers
        • Cloud computing
        • gcp
          • Google Cloud
        • aws
          • AWS Amplify
          • AWS
        • azure
          • Azure
      • articles
        • Articles
      • anki
        • Anki
      • data-science
        • Data Science
        • Data Visualization
        • Data processing
        • Apache Kafka
      • consciousness
        • Consciousness
        • Ego
      • documentaries
        • Documentaries
      • Summary
      • api
        • API
      • animals
        • Birds
        • Animals
      • courses
        • Courses
      • analytics
        • Analytics
      • chemistry
        • Chemistry
Powered by GitBook
On this page

Was this helpful?

  1. 14-Pure-Education
  2. My Knowledge Wiki 🌿
  3. books

Cracking the coding interview

Chapter 1 - arrays and strings

  • Hash table is a data structure that maps keys to values for highly efficient lookup.

    • In a very simple implementation of a hash table, the hash table has an underlying array and a hash function.

    • When you want to insert an object and its key, the hash function maps the key to an integer, which indicates the index in the array. The object is then stored at that index.

  • We can implement the hash table with a binary search tree.

    • We can then guarantee an 0(log n) lookup time, since we can keep the tree balanced.

    • Additionally, we may use less space, since a large array no longer needs to be allocated in the very beginning.

  • ArrayList (dynamical resizing array)

    • An ArrayList, or a dynamically resizing array, is an array that resizes itself as needed while still providing 0(1) access.

    • A typical implementation is that when the array is full, the array doubles in size.

      • Each doubling takes 0(n) time, but happens so rarely that its amortized time is still O(1).

PreviousCrafting interpretersNextArtificial Intelligence: A Modern Approach

Last updated 4 years ago

Was this helpful?