Skip to content

Commit 292aa42

Browse files
Formatted code with gofmt -s to meet style requirements
1 parent 1becd63 commit 292aa42

File tree

14 files changed

+23
-23
lines changed

14 files changed

+23
-23
lines changed

cipher/caesar/caesar.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Package caesar is the shift cipher
22
// description: Caesar cipher
3-
// details : Caesar cipher is a type of substitution cipher in which each letter in the plaintext is shifted a certain number of places down the alphabet.
3+
// details : Caesar cipher is a type of substitution cipher in which each letter in the plaintext is shifted a certain number of places down the alphabet.
44
// time complexity: O(n)
55
// space complexity: O(n)
66
// ref: https://en.wikipedia.org/wiki/Caesar_cipher

cipher/diffiehellman/diffiehellmankeyexchange.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Package diffiehellman implements Diffie-Hellman Key Exchange Algorithm
22
// description: Diffie-Hellman key exchange
3-
// details : Diffie-Hellman key exchange is a method of securely exchanging cryptographic keys over a public channel by combining private keys of two parties to generate a shared secret key.
3+
// details : Diffie-Hellman key exchange is a method of securely exchanging cryptographic keys over a public channel by combining private keys of two parties to generate a shared secret key.
44
// time complexity: O(log(n))
55
// space complexity: O(1)
66
// for more information watch : https://www.youtube.com/watch?v=NmM9HA2MQGI

cipher/railfence/railfence.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// railfence.go
22
// description: Rail Fence Cipher
3-
// details: The rail fence cipher is a an encryption algorithm that uses a rail fence pattern to encode a message. it is a type of transposition cipher that rearranges the characters of the plaintext to form the ciphertext.
3+
// details: The rail fence cipher is a an encryption algorithm that uses a rail fence pattern to encode a message. it is a type of transposition cipher that rearranges the characters of the plaintext to form the ciphertext.
44
// time complexity: O(n)
55
// space complexity: O(n)
66
// ref: https://en.wikipedia.org/wiki/Rail_fence_cipher

cipher/rot13/rot13.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Package rot13 is a simple letter substitution cipher that replaces a letter with the 13th letter after it in the alphabet.
22
// description: ROT13
3-
// details: ROT13 is a simple letter substitution cipher that replaces a letter with the 13th letter after it in the alphabet. it is a special case of the Caesar cipher
3+
// details: ROT13 is a simple letter substitution cipher that replaces a letter with the 13th letter after it in the alphabet. it is a special case of the Caesar cipher
44
// time complexity: O(n)
55
// space complexity: O(n)
66
// ref: https://en.wikipedia.org/wiki/ROT13

dynamic/uniquepaths.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// See https://leetcode.com/problems/unique-paths/
22
// time complexity: O(m*n) where m and n are the dimensions of the grid
3-
// space complexity: O(m*n) where m and n are the dimensions of the grid
3+
// space complexity: O(m*n) where m and n are the dimensions of the grid
44
// author: Rares Mateizer (https://github.com/rares985)
55
package dynamic
66

graph/bellmanford.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// https://en.wikipedia.org/wiki/Bellman%E2%80%93Ford_algorithm
55
// Implementation is based on the book 'Introduction to Algorithms' (CLRS)
66
// time complexity: O(V*E) where V is the number of vertices and E is the number of edges in the graph
7-
// space complexity: O(V) where V is the number of vertices in the graph
7+
// space complexity: O(V) where V is the number of vertices in the graph
88

99
package graph
1010

graph/breadthfirstsearch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package graph
33
// BreadthFirstSearch is an algorithm for traversing and searching graph data structures.
44
// It starts at an arbitrary node of a graph, and explores all of the neighbor nodes
55
// at the present depth prior to moving on to the nodes at the next depth level.
6-
// Worst-case performance O(|V|+|E|)=O(b^{d})}O(|V|+|E|)=O(b^{d}) where |V| is the number of vertices and |E| is the number of edges in the graph and b is the branching factor of the graph (the average number of successors of a node). d is the depth of the goal node.
6+
// Worst-case performance O(|V|+|E|)=O(b^{d})}O(|V|+|E|)=O(b^{d}) where |V| is the number of vertices and |E| is the number of edges in the graph and b is the branching factor of the graph (the average number of successors of a node). d is the depth of the goal node.
77
// Worst-case space complexity O(|V|)=O(b^{d})}O(|V|)=O(b^{d}) where |V| is the number of vertices and |E| is the number of edges in the graph and b is the branching factor of the graph (the average number of successors of a node). d is the depth of the goal node.
88
// reference: https://en.wikipedia.org/wiki/Breadth-first_search
99
func BreadthFirstSearch(start, end, nodes int, edges [][]int) (isConnected bool, distance int) {

graph/coloring/bipartite.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
// bipartite.go
1+
package coloring
2+
3+
// Bipartite.go
24
// description: Implementation of the Bipartite graph coloring algorithm
35
// details: A bipartite graph is a graph whose vertices can be divided into two disjoint sets U and V such that every edge connects a vertex in U to one in V. The Bipartite graph coloring algorithm is used to determine if a graph is bipartite or not.
46
// time complexity: O(V+E) where V is the number of vertices and E is the number of edges in the graph
57
// space complexity: O(V) where V is the number of vertices in the graph
68

7-
package coloring
8-
99
func (g *Graph) TryBipartiteColoring() map[int]Color {
10-
// 0 is uncolored, 1/2 is colors
10+
// 0 is uncolored, 1/2 are colors
1111
colors := make(map[int]Color)
1212
visited := make(map[int]bool)
1313

@@ -16,8 +16,8 @@ func (g *Graph) TryBipartiteColoring() map[int]Color {
1616
visited[i] = false
1717
}
1818

19-
var color_node func(int)
20-
color_node = func(s int) {
19+
var colorNode func(int)
20+
colorNode = func(s int) {
2121
visited[s] = true
2222
coloring := []Color{0, 2, 1}
2323

@@ -26,15 +26,15 @@ func (g *Graph) TryBipartiteColoring() map[int]Color {
2626
colors[n] = coloring[colors[s]]
2727
}
2828
if !visited[n] {
29-
color_node(n)
29+
colorNode(n)
3030
}
3131
}
3232
}
3333

3434
for i := range g.edges {
3535
if colors[i] == 0 {
3636
colors[i] = 1
37-
color_node(i)
37+
colorNode(i)
3838
}
3939
}
4040

graph/lowestcommonancestor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Let `T` be a tree. The LCA of `u` and `v` in T is the shared ancestor of `u` and `v`
55
// that is located farthest from the root.
66
// time complexity: O(n log n) where n is the number of vertices in the tree
7-
// space complexity: O(n log n) where n is the number of vertices in the tree
7+
// space complexity: O(n log n) where n is the number of vertices in the tree
88
// references: [cp-algorithms](https://cp-algorithms.com/graph/lca_binary_lifting.html)
99
// author(s) [Dat](https://github.com/datbeohbbh)
1010
// see lowestcommonancestor_test.go for a test implementation.

math/binomialcoefficient.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// a binomial coefficient C(n,k) gives number ways
55
// in which k objects can be chosen from n objects.
66
// wikipedia: https://en.wikipedia.org/wiki/Binomial_coefficient
7-
// time complexity: O(k) or O(n-k) whichever is smaller (O(n) in worst case)
7+
// time complexity: O(k) or O(n-k) whichever is smaller (O(n) in worst case)
88
// space complexity: O(1)
99
// author: Akshay Dubey (https://github.com/itsAkshayDubey)
1010
// see binomialcoefficient_test.go

0 commit comments

Comments
 (0)