From 174c216c1f42e1e15692db5de8fdf8b7d23749f8 Mon Sep 17 00:00:00 2001 From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com> Date: Mon, 3 Oct 2022 12:01:35 +0530 Subject: [PATCH 01/11] Update --- errata.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 errata.md diff --git a/errata.md b/errata.md new file mode 100644 index 0000000..146bda0 --- /dev/null +++ b/errata.md @@ -0,0 +1,18 @@ +# Errata, Corrections and Improvements +---------------------------------------------------- +If you find any mistakes in the third edition of Hands On Data Structures and Algorithms with Python book, or if you have suggestions for improvements, then please [raise an issue in this repository]([https://github.com/PacktPublishing/JavaScript-from-Beginner-to-Professional/issues](https://github.com/PacktPublishing/Hands-On-Data-Structures-and-Algorithms-with-Python-Third-Edition/issues)), or email to us. + +## Chapter 13, Page 403 - Fixing the reference to `ord` array + +There should be a reference calling to the `ord` array as `ord_text` in the `generate_hash` function. + +Incorrect code is: +``` +else: + hash_text[i] = ((hash_text[i-1] - ord_text[i-1]) + ord[i+len_pattern-1]) # calculating next hash value using previous value +``` +Correct code is: +``` +else: + hash_text[i] = ((hash_text[i-1] - ord_text[i-1]) + ord_text[i+len_pattern-1]) # calculating next hash value using previous value +``` From 27d279dee4772be41aea9194c277175205a0050c Mon Sep 17 00:00:00 2001 From: Packt-ITService <62882280+Packt-ITService@users.noreply.github.com> Date: Tue, 25 Oct 2022 08:24:19 +0100 Subject: [PATCH 02/11] add free ebook notification --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 12ec142..d0e681a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,6 @@ # Hands-On Data-Structures-and-Algorithms-with-Python-Third-Edition-published-by-Packt Hands-On Data Structures and Algorithms with Python – Third Edition +### Download a free PDF + + If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.
+

https://packt.link/free-ebook/9781801073448

\ No newline at end of file From ddecd4dfbf687cbd76548f30024d19027a4fb2f8 Mon Sep 17 00:00:00 2001 From: Packt-ITService <62882280+Packt-ITService@users.noreply.github.com> Date: Wed, 14 Dec 2022 13:10:40 +0530 Subject: [PATCH 03/11] add free ebook notification --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index d0e681a..156598c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,15 @@ + +### Get this product for $5 + +Packt is having its biggest sale of the year. Get this eBook or any other book, video, or course that you like just for $5 each + + +

[Buy now](https://packt.link/9781801073448)

+ + +

[Buy similar titles for just $5](https://subscription.packtpub.com/search)

+ + # Hands-On Data-Structures-and-Algorithms-with-Python-Third-Edition-published-by-Packt Hands-On Data Structures and Algorithms with Python – Third Edition ### Download a free PDF From b0bf14743414e266e0e4e73e75d179859397b4c3 Mon Sep 17 00:00:00 2001 From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com> Date: Mon, 9 Jan 2023 18:26:29 +0530 Subject: [PATCH 04/11] Update binary_search.py --- Chapter03/binary_search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Chapter03/binary_search.py b/Chapter03/binary_search.py index d07b955..8042a39 100644 --- a/Chapter03/binary_search.py +++ b/Chapter03/binary_search.py @@ -1,6 +1,6 @@ def binary_search(arr, start, end, key): while start <= end: - mid = start + (end - start)/2) + mid = start + (end - start)/2 if arr[mid] == key: return mid elif arr[mid] < key: From 515b4e6f42c08eba8bbe288878dedc33924460f6 Mon Sep 17 00:00:00 2001 From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com> Date: Tue, 10 Jan 2023 11:03:39 +0530 Subject: [PATCH 05/11] Update binary_search.py --- Chapter03/binary_search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Chapter03/binary_search.py b/Chapter03/binary_search.py index 8042a39..09a6444 100644 --- a/Chapter03/binary_search.py +++ b/Chapter03/binary_search.py @@ -1,6 +1,6 @@ def binary_search(arr, start, end, key): while start <= end: - mid = start + (end - start)/2 + mid = start + (end - start)//2 if arr[mid] == key: return mid elif arr[mid] < key: From c8e9a280b290bd8c98c88b4d2c07e3f6e5b203c7 Mon Sep 17 00:00:00 2001 From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com> Date: Tue, 10 Jan 2023 11:12:43 +0530 Subject: [PATCH 06/11] Update errata.md --- errata.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/errata.md b/errata.md index 146bda0..ed12f49 100644 --- a/errata.md +++ b/errata.md @@ -16,3 +16,20 @@ Correct code is: else: hash_text[i] = ((hash_text[i-1] - ord_text[i-1]) + ord_text[i+len_pattern-1]) # calculating next hash value using previous value ``` + +## Chapter 3, Page 61 - Fixed the missing '/' + +There should be `//` in place of `/` + +Incorrect code is: +``` +mid = start + (end - start)/2 +if arr[mid] == key: + return mid +``` +Correct code is: +``` +mid = start + (end - start)//2 +if arr[mid] == key: + return mid +``` From da959a8ae7b88e214901e0cfdd2ad2f2478e1f83 Mon Sep 17 00:00:00 2001 From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com> Date: Tue, 10 Jan 2023 11:14:13 +0530 Subject: [PATCH 07/11] Update errata.md --- errata.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/errata.md b/errata.md index ed12f49..b529c3f 100644 --- a/errata.md +++ b/errata.md @@ -22,13 +22,13 @@ else: There should be `//` in place of `/` Incorrect code is: -``` +```python mid = start + (end - start)/2 if arr[mid] == key: return mid ``` Correct code is: -``` +```python mid = start + (end - start)//2 if arr[mid] == key: return mid From 16ae778fde5dd7f6266cdbb9aa8f6436087cbd58 Mon Sep 17 00:00:00 2001 From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com> Date: Tue, 10 Jan 2023 11:15:12 +0530 Subject: [PATCH 08/11] Update errata.md --- errata.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/errata.md b/errata.md index b529c3f..1ea38f0 100644 --- a/errata.md +++ b/errata.md @@ -17,7 +17,7 @@ else: hash_text[i] = ((hash_text[i-1] - ord_text[i-1]) + ord_text[i+len_pattern-1]) # calculating next hash value using previous value ``` -## Chapter 3, Page 61 - Fixed the missing '/' +## Chapter 3, Page 61 - Fixed the missing '/' in **binary search** code There should be `//` in place of `/` From b76dabd10b4a047102d31ec7db4f8f1013ac46df Mon Sep 17 00:00:00 2001 From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com> Date: Tue, 10 Jan 2023 11:15:37 +0530 Subject: [PATCH 09/11] Update errata.md --- errata.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/errata.md b/errata.md index 1ea38f0..a68ce37 100644 --- a/errata.md +++ b/errata.md @@ -17,7 +17,7 @@ else: hash_text[i] = ((hash_text[i-1] - ord_text[i-1]) + ord_text[i+len_pattern-1]) # calculating next hash value using previous value ``` -## Chapter 3, Page 61 - Fixed the missing '/' in **binary search** code +## Chapter 3, Page 61 - Fixed the missing '/' in `binary search` code There should be `//` in place of `/` From ac7828fe06d7e6591ce342de2e30aaf6578868e8 Mon Sep 17 00:00:00 2001 From: Packt-ITService <62882280+Packt-ITService@users.noreply.github.com> Date: Wed, 18 Jan 2023 15:20:57 +0530 Subject: [PATCH 10/11] remove 5$ campaign - 2022 --- README.md | 9 --------- 1 file changed, 9 deletions(-) diff --git a/README.md b/README.md index 156598c..94bd315 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,4 @@ -### Get this product for $5 - -Packt is having its biggest sale of the year. Get this eBook or any other book, video, or course that you like just for $5 each - - -

[Buy now](https://packt.link/9781801073448)

- - -

[Buy similar titles for just $5](https://subscription.packtpub.com/search)

# Hands-On Data-Structures-and-Algorithms-with-Python-Third-Edition-published-by-Packt From f234dae2579165320218f49dbd0d9675507113bb Mon Sep 17 00:00:00 2001 From: Karan <50290386+Sonawane-Karan26@users.noreply.github.com> Date: Mon, 6 Mar 2023 13:16:21 +0530 Subject: [PATCH 11/11] Update errata.md --- errata.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/errata.md b/errata.md index a68ce37..9cc9cd7 100644 --- a/errata.md +++ b/errata.md @@ -33,3 +33,20 @@ mid = start + (end - start)//2 if arr[mid] == key: return mid ``` + + +## Chapter 1, Page 23 - Fixed the missing outputs + +This is the actual dictionary +`mydict = {'a': 1, 'b': 2, 'c': 3}` + +|Function |Description |Example| +| :-------:| :-------: | :-------: | +| `mydict.pop()`| If a given key is present in the dictionary, then this function will remove the key and return the associated value. | `print(mydict.pop('b'))` should give you output `2` | +| `| | `print(mydict)` should give you output `{'a': 1, 'c': 3}` | +| `mydict.popitem()`| This method removes the last key-value pair added in the dictionary and returns it as a tuple. | `print(mydict.popitem())` should give you output `('c', 3)` | +| `| | `print(mydict)` should give you output `{'a': 1, 'b': 2}` | +| `mydict.update()`| Merges one dictionary with another. Firstly, it checks whether a key of the second dictionary is present in the fi rst dictionary; the corresponding value is then updated. If the key is not present in the fi rst dictionary, then the key-value pair is added. | It has two dictionaries as `d1 = {'a': 10, 'b': 20, 'c': 30}` and `d2 = {'b': 200, 'd': 400}`| +| | | `d1.update(d2)` should update values of `d2` on `d1` | +| | | `print(d1)` should give you `{'a': 10, 'b': 200, 'c': 30, 'd': 400}` | +