📘
Grokking-Algorithms book
PostgreSQL
  • Content
  • Introduction to Algorithms
    • Introduction
    • Binary Search
    • Big O notation
    • Recap
  • Selection sort
    • How memory works
    • Arrays and linked lists
    • Selection sort
    • Recap
  • Recursion
    • Recursion
    • Base case and recursive case
    • The stack
    • Recap
  • Quicksort
    • Divide & conquer
    • Quicksort
    • Big O notation revisited
    • Recap
  • Hash tables
    • Hash functions
    • Use cases
    • Collisions
    • Performance
    • Recap
  • Breadth-first search
    • Introduction to graph
    • What is a graph
    • Breadth-first search
    • Implementing the graph
    • Implementing the algorithm
    • Recap
  • Dijkstra's algorithm
    • Working with Dijkstra's algorithm
    • Terminology
    • Trading for a piano
    • Negative-weight edges
    • Implementation
    • Recap
  • Greedy Algorithms
    • The classroom scheduling problem
    • The knapsack problem
    • The set-covering problem
    • NP-complete problems
    • Traveling salesperson, step by step
    • Recap
  • Dynamic programming
    • The knapsack problem
    • Knapsack problem FAQ
    • Longest common substring
    • Recap
  • K-nearest neighbors
    • Classifying oranges vs. grapefruit
    • Building a recommendations system
    • Introduction to machine learning
    • Recap
  • Where to go next
    • Trees
    • Inverted indexes
    • The Fourier transform
    • Parallel algorithms
    • MapReduce
    • Bloom filters and HyperLogLog
    • The SHA algorithms
    • Locality-sensitive hashing
    • Diffie-Hellman key exchange
    • Linear programming
    • Epilogue
  • Answers to exercises
    • Chapter 1
    • Chapter 2
    • Chapter 3
    • Chapter 4
    • Chapter 5
    • Chapter 6
    • Chapter 7
    • Chapter 8
    • Chapter 9
    • Chapter 10
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub

Dijkstra's algorithm

PreviousRecapNextWorking with Dijkstra's algorithm

Last updated 1 year ago

Was this helpful?

• Biz grafiklarni muhokama qilishni davom ettiramiz va siz vaznli grafiklar haqida bilib olasiz: ba'zi qirralarga ko'proq yoki kamroq og'irlik berish usuli.

• Siz Dijkstra algoritmini o'rganasiz, bu sizga "Xga eng qisqa yo'l nima?"ss degan savolga javob berishga imkon beradi. vaznli grafiklar uchun.

• Siz Dijkstra algoritmi ishlamaydigan grafiklardagi sikllar haqida bilib olasiz.

Oxirgi bobda siz A nuqtadan B nuqtaga o'tish yo'lini aniqladingiz.

Bu eng tezkor yo'l bo'lishi shart emas. Bu eng qisqa yo'l, chunki u eng kam sonli segmentlarga ega (uch segment). Ammo siz ushbu segmentlarga sayohat vaqtlarini qo'shsangiz, deylik. Endi siz tezroq yo'l borligini ko'rasiz.

Oxirgi bobda birinchi boʻlib qidiruvdan foydalangansiz. Kenglik-birinchi qidiruv sizga eng kam segmentli yo'lni topadi (birinchi grafik bu erda ko'rsatilgan). Buning o'rniga eng tez yo'lni xohlasangiz nima bo'ladi (ikkinchi grafik)? Buni Dijkstra algoritmi deb ataladigan boshqa algoritm yordamida eng tez bajarishingiz mumkin.

point
times
Page cover image