You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/distance-between-points.md
+31-2Lines changed: 31 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -119,11 +119,38 @@ manhattan_distance(P, Q) {
119
119
}
120
120
```
121
121
122
+
## Minkowski Distance
123
+
124
+
**Minkowski Distance** is a metric in a normed vector space which can be considered as a generalization of both the Euclidean distance and the Manhattan distance. It is named after the German mathematician Hermann Minkowski.
125
+
126
+
### Formula
127
+
128
+
The formula below applies when calculating the Minkowski distance over an N-dimensional grid:
Copy file name to clipboardExpand all lines: docs/linear-search.md
+33-1Lines changed: 33 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,4 +4,36 @@ title: Linear search
4
4
sidebar_label: Linear search
5
5
---
6
6
7
-
[Open a pull request](https://github.com/AllAlgorithms/algorithms/tree/master/docs/linear-search.md) to add the content for this algorithm.
7
+
**Linear Search** or commonly called as sequential search is a method for finding an element within a list. It sequentially checks each element of the list until a match is found or the whole list has been searched.
8
+
9
+
## Algorithm
10
+
11
+
Linear Search requires two parameters: the array/list and the key. It traverses the entire array/list starting from the first element to the last element of the array. During the traversal, the algorithm checks if the element is equal to the key. Once it finds an element that equals to the key, the function immediately returns the index. The result will be considered as `NOT FOUND` if there is no any element in the array equals the key.
12
+
13
+
The algorithm can be expressed in pseudocode as follows:
14
+
15
+
```
16
+
LinearSearch(array, key){
17
+
idx = 0
18
+
for idx = 0...n
19
+
if array[idx] = key then
20
+
return idx
21
+
22
+
return -1
23
+
}
24
+
```
25
+
26
+
Here is the simulation of Linear Search Algorithm:
0 commit comments