From e5b5944c6849389bbfc39f476fa7a1f97d8ce4c6 Mon Sep 17 00:00:00 2001 From: Alexander Cyon Date: Sat, 13 Jul 2024 20:56:39 +0200 Subject: [PATCH 1/2] Fix four typos (#1139) --- .../uncategorized/best-time-to-buy-sell-stocks/README.md | 2 +- src/algorithms/uncategorized/n-queens/README.md | 2 +- src/data-structures/bloom-filter/README.md | 2 +- src/data-structures/heap/Heap.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/algorithms/uncategorized/best-time-to-buy-sell-stocks/README.md b/src/algorithms/uncategorized/best-time-to-buy-sell-stocks/README.md index 9446993e..975eade3 100644 --- a/src/algorithms/uncategorized/best-time-to-buy-sell-stocks/README.md +++ b/src/algorithms/uncategorized/best-time-to-buy-sell-stocks/README.md @@ -46,7 +46,7 @@ Let's say we have an array of prices `[7, 6, 4, 3, 1]` and we're on the _1st_ da 1. _Option 1: Keep the money_ → profit would equal to the profit from buying/selling the rest of the stocks → `keepProfit = profit([6, 4, 3, 1])`. 2. _Option 2: Buy/sell at current price_ → profit in this case would equal to the profit from buying/selling the rest of the stocks plus (or minus, depending on whether we're selling or buying) the current stock price → `buySellProfit = -7 + profit([6, 4, 3, 1])`. -The overall profit would be equal to → `overalProfit = Max(keepProfit, buySellProfit)`. +The overall profit would be equal to → `overallProfit = Max(keepProfit, buySellProfit)`. As you can see the `profit([6, 4, 3, 1])` task is being solved in the same recursive manner. diff --git a/src/algorithms/uncategorized/n-queens/README.md b/src/algorithms/uncategorized/n-queens/README.md index 077e26d7..39925676 100644 --- a/src/algorithms/uncategorized/n-queens/README.md +++ b/src/algorithms/uncategorized/n-queens/README.md @@ -59,7 +59,7 @@ and return false. queen here leads to a solution. b) If placing queen in [row, column] leads to a solution then return true. - c) If placing queen doesn't lead to a solution then umark this [row, + c) If placing queen doesn't lead to a solution then unmark this [row, column] (Backtrack) and go to step (a) to try other rows. 3) If all rows have been tried and nothing worked, return false to trigger backtracking. diff --git a/src/data-structures/bloom-filter/README.md b/src/data-structures/bloom-filter/README.md index e156310c..7880a7f7 100644 --- a/src/data-structures/bloom-filter/README.md +++ b/src/data-structures/bloom-filter/README.md @@ -93,7 +93,7 @@ three factors: the size of the bloom filter, the number of hash functions we use, and the number of items that have been inserted into the filter. -The formula to calculate probablity of a false positive is: +The formula to calculate probability of a false positive is: ( 1 - e -kn/m ) k diff --git a/src/data-structures/heap/Heap.js b/src/data-structures/heap/Heap.js index 45dfcfa2..b978739e 100644 --- a/src/data-structures/heap/Heap.js +++ b/src/data-structures/heap/Heap.js @@ -279,7 +279,7 @@ export default class Heap { /* istanbul ignore next */ pairIsInCorrectOrder(firstElement, secondElement) { throw new Error(` - You have to implement heap pair comparision method + You have to implement heap pair comparison method for ${firstElement} and ${secondElement} values. `); } From 9046d80bdb9e5c2e65c87369575a3e47e9c01978 Mon Sep 17 00:00:00 2001 From: Mahdi Azarboon <21277296+azarboon@users.noreply.github.com> Date: Sun, 14 Jul 2024 02:58:45 +0800 Subject: [PATCH 2/2] Update README.md (#1141) Before diving into any of the data structures, readers should be reminded of two fundamental laws in software architecture: 1.Everything is a trade-ff 2."Why is more important than the how" So, readers face the nuances and reality of these data structures from the beginning. These two laws are coined by two thought leaders in software architecture: Mark Richards and Neal Ford. They have explained these two laws in various conference talks and books. For example, here you can read about these two laws here: https://www.infoq.com/podcasts/software-architecture-hard-parts/ Also, here is a book for reference: https://a.co/d/fKOodW9 Co-authored-by: Oleksii Trekhleb <3000285+trekhleb@users.noreply.github.com> --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index e06cfb90..8fa63142 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,8 @@ be accessed and modified efficiently. More precisely, a data structure is a coll values, the relationships among them, and the functions or operations that can be applied to the data. +Remember that each data has its own trade-offs. And you need to pay attention more to why you're choosing a certain data structure than to how to implement it. + `B` - Beginner, `A` - Advanced * `B` [Linked List](src/data-structures/linked-list)