Skip to content

Commit 70ab652

Browse files
authored
add preface to export, small fixes in other sections (#118)
1 parent 2782d87 commit 70ab652

File tree

10 files changed

+11
-13
lines changed

10 files changed

+11
-13
lines changed

.github/scripts/export-md.sh

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ source "${SCRIPT_DIR}/sections.sh"
88

99
declare -a files=(
1010
README.md
11+
preface.md
1112
complexity.md
1213
)
1314
files+=("${sections[@]/%//README.md}")

array/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ func main() {
6464
nums = nums[:len(nums)-1] // drop last element
6565
nums = nums[1:] // drop first element
6666
nums = nums[1:] // all elements from index 1 to the end
67-
nums = nums[:2] // all elements from index 0 to 2
68-
nums = nums[1:2] // the element from index 1 to 2
67+
nums = nums[:2] // all elements from index 0 to 1
68+
nums = nums[1:2] // the element at index 1
6969
fmt.Println(nums) // Prints [4]
7070
}
7171
```

complexity.md

-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ The time complexity of O(n*Log n) is commonly observed when it is necessary to i
117117
* [Heap Sort](./heap/heap_sort.go)
118118
* [Knapsack](./greedy/knapsack.go)
119119
* [Find Anagrams](./hashtable/find_anagrams.go)
120-
* In order traversal of a [Binary Search Tree](./tree/README.md)
121120

122121
### Polynomial - O(n^2)
123122

graph/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,11 @@ When working with graphs, searching to solve problems is often necessary. The al
8888
* **Breadth First Search - BFS** used to find the shortest path
8989
* **Depth First Search - DFS** often a subroutine, in another algorithm. Used in maze traversal, cycle finding, and pathfinding
9090

91-
Both BFS and DFS can be [implemented iteratively using a container (queue or stack)](./iterative_traversal_test.go).
91+
BFS can be implemented iteratively using a [queue](../queue/) and DFS can be implemented iteratively using a [stack](../stack/). This is demonstrated in the [iterative traversal](./iterative_traversal_test.go) rehearsal.
9292

9393
#### Breadth First Search - BFS
9494

95-
BFS is a non-recursive algorithm that employs a [queue](../queue) and is a generalization of [post-order traversal](../tree) in a tree. When provided with a graph G and a vertex V, BFS systematically explores all nodes in G that are reachable from V, as illustrated in the following example:
95+
BFS is a non-recursive algorithm that employs a [queue](../queue). When provided with a graph G and a vertex V, BFS systematically explores all nodes in G that are reachable from V, as illustrated in the following example:
9696

9797
```Go
9898
package main

greedy/README.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ Therefore, greed and greedy algorithms may not always produce optimal solutions
88

99
## Implementation
1010

11-
The process for developing a greedy algorithm can be structured into six steps.
12-
1311
The process for developing a greedy algorithm can be broken down into six steps:
1412

1513
1. Identify the optimal problem structure.

hashtable/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Hash Table
22

3-
Hash tables are a fundamental data structure that operates based on key-value pairs and enables constant-time operations for lookup, insertion, and deletion. Hash tables use immutable keys that can be strings or integers among other things. However, in more complex applications, a hashing function, and different collision resolution methods such as separate chaining, linear probing, quadratic probing, and double hashing, can be used to ensure efficient performance.
3+
Hash tables are a fundamental data structure that operates based on key-value pairs and enables constant-time operations for lookup, insertion, and deletion. Hash tables use immutable keys that can be strings or integers among other things. However, in more complex applications, a hashing function, and different collision resolution methods such as separate chaining, linear probing, quadratic probing, and double hashing, can be used.
44

55
## Implementation
66

preface.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This collection became a valuable resource, and I sought to share its benefits w
1414

1515
## Choosing Go as the Language
1616

17-
Go initially aimed to replace C and C++, an ambitious goal given that operating systems like Linux and Windows and programming languages like Java and Python are written in C and C++. Go has matured over the past decade into a robust and solid option, finding its niche particularly in systems engineering where reliability and performance are essential.
17+
Go initially aimed to be a successor for C++, an ambitious goal given that operating systems like Linux and Windows and programming languages like Java and Python are written in C and C++. Go has matured over the past decade into a robust and solid option, finding its niche particularly in systems engineering where reliability and performance are essential.
1818

1919
Go is simple. This simplicity is evident in several aspects. The language features few [keywords](https://go.dev/ref/spec#Keywords) that programmers from any background would likely recognize. Its syntax is minimal, offering a single type of loop, and no brackets are needed for conditions in if or for statements. The Go standard library, written in Go and assembly language, is frequently used not only to understand the internals of Go but also to learn how to write idiomatic Go code. Go maintains backward compatibility for its standard API, and significant changes require approval from the three original authors, ensuring that the language does not become a "Frankenstein".
2020

recursion/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Recursion is a computational technique that implements a [divide-and-conquer](../dnc) approach to problem-solving by breaking down a complex problem into smaller sub-problems. It consists of two components:
44

5-
* One or more base cases that provide output for simple inputs
5+
* One or more base cases that provide output for simple inputs and terminate recursion
66
* A recursive case that combines the outputs obtained from recursive function calls to generate a solution for the original problem.
77

88
Although recursions enhance code readability, they are usually inefficient and challenging to debug. Consequently, unless they provide a more efficient solution to a problem, such as in the case of [quicksort](../dnc/quick_sort_test.go), they are generally not preferred.

strings/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ In Go, strings are a data type. Behind the scenes strings are a slice of bytes.
1313
* [Title](https://golang.org/pkg/strings/#Title), [ToLower](https://golang.org/pkg/strings/#ToLower), [ToUpper](https://golang.org/pkg/strings/#ToUpper)
1414
* [Trim](https://golang.org/pkg/strings/#Trim), [TrimSpace](https://golang.org/pkg/strings/#TrimSpace), [TrimSuffix](https://golang.org/pkg/strings/#TrimSuffix), [TrimPrefix](https://golang.org/pkg/strings/#TrimPrefix)
1515

16-
When a string is iterated in Go using the `range` keyword, every element becomes a [rune](https://blog.golang.org/strings#TOC_5.) which is the same as `int32`. If the code being written works with many single-character strings, it is better to define variables and function parameters as `rune`. The following code shows how to iterate through a string.
16+
When a string is iterated in Go using the `range` keyword, every element becomes a [rune](https://blog.golang.org/strings#TOC_5.) which is an alias for the type `int32`. If the code being written works with many single-character strings, it is better to define variables and function parameters as `rune`. The following code shows how to iterate through a string.
1717

1818
```Go
1919
package main

tree/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Traversing a tree means exploring every node in a tree and performing some work
1010
4 Traversal Name Order Example
1111
/ \
1212
/ \ In-Order left,self,right 1,2,3,4,5,6,7
13-
2 6 Pre-Order,DFS self,left,right 4,2,1,3,6,5,7
14-
/ \ / \ Post-Order,BFS left,right,self 1,3,2,5,7,6,4
13+
2 6 Pre-Order self,left,right 4,2,1,3,6,5,7
14+
/ \ / \ Post-Order left,right,self 1,3,2,5,7,6,4
1515
1 3 5 7
1616
```
1717

0 commit comments

Comments
 (0)