Blog

Your dream job? Lets Git IT.
Interactive technical interview preparation platform designed for modern developers.

XGitHub

Platform

  • Categories

Resources

  • Blog
  • About the app
  • FAQ
  • Feedback

Legal

  • Privacy Policy
  • Terms of Service

© 2025 LetsGit.IT. All rights reserved.

LetsGit.IT/Categories/Data Structures
Data Structuresmedium

Adjacency list vs adjacency matrix — when to use which?

Tags
#graph#adjacency-list#adjacency-matrix#complexity
Back to categoryPractice quiz

Answer

A matrix uses O(V^2) memory and gives O(1) edge checks, so it’s good for dense graphs. A list uses O(V+E) memory and is better for sparse graphs and iterating neighbors.

Related questions

Data Structures
Adjacency list vs adjacency matrix: when do you choose each?
#graph#adjacency-list#adjacency-matrix
Data Structures
Building a heap from an array: why can it be O(n), not O(n log n)?
#heap#heapify#complexity
Algorithms
Heap sort: what are its time complexity, space complexity, and stability?
#heapsort
#sorting
#complexity
Algorithms
Bitmask DP (subset DP): what is it and what is a typical complexity?
#dp#bitmask#subset
Algorithms
Sliding window: what is it and when is it better than nested loops?
#sliding-window#two-pointers#complexity