Skip to content

Commit 3c6030f

Browse files
authored
Merge pull request #173 from imVivekGupta/sort_doc
Updated Sorting README
2 parents bc37c86 + 2b47094 commit 3c6030f

File tree

4 files changed

+34
-12
lines changed

4 files changed

+34
-12
lines changed

Diff for: Competitive Coding/Graphs/Shortest Path/dijsktra/README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ Edsger W.Dijkstra
99
Dijkstra thought about the shortest path problem when working at the Mathematical Center in Amsterdam in 1956 as a programmer to demonstrate capabilities of a new computer called ARMAC. His objective was to choose both a problem as well as an answer (that would be produced by computer) that non-computing people could understand. He designed the shortest path algorithm and later implemented it for ARMAC for a slightly simplified transportation map of 64 cities in the Netherlands (64, so that 6 bits would be sufficient to encode the city number).
1010
A year later, he came across another problem from hardware engineers working on the institute's next computer: minimize the amount of wire needed to connect the pins on the back panel of the machine. As a solution, he re-discovered the algorithm known as Prim's minimal spanning tree algorithm (known earlier to Jarník, and also rediscovered by Prim).
1111
Dijkstra published the algorithm in 1959, two years after Prim and 29 years after Jarník.
12-
13-
12+
13+
1414
**Algorithm**
15-
15+
1616
Let the node at which we are starting be called the initial node. Let the distance of node Y be the distance from the initial node to Y. Dijkstra's algorithm will assign some initial distance values and will try to improve them step by step.
1717

1818
Assign to every node a tentative distance value: set it to zero for our initial node and to infinity for all other nodes.
@@ -29,7 +29,7 @@ Otherwise, select the unvisited node that is marked with the smallest tentative
2929

3030
---------------------------------------------------
3131

32-
##Related Problems
32+
## Related Problems
3333
The functionality of Dijkstra's original algorithm can be extended with a variety of modifications. For example, sometimes it is desirable to present solutions which are less than mathematically optimal. To obtain a ranked list of less-than-optimal solutions, the optimal solution is first calculated. A single edge appearing in the optimal solution is removed from the graph, and the optimum solution to this new graph is calculated. Each edge of the original solution is suppressed in turn and a new shortest-path calculated. The secondary solutions are then ranked and presented after the first optimal solution.
3434

3535
Dijkstra's algorithm is usually the working principle behind link-state routing protocols, OSPF and IS-IS being the most common ones.
@@ -47,16 +47,16 @@ Fast marching method can be viewed as a continuous version of Dijkstra's algorit
4747

4848
----------------------------------------------------------
4949

50-
##Applications
50+
## Applications
5151

5252
1. **Flight Agenda** -- A travel agent requests software for making an agenda of flights for clients. The agent has access to a data base with all airports and flights. Besides the flight number, origin airport and destination, the flights have departure and arrival time. Specifically the agent wants to determine the earliest arrival time for the destination given an origin airport and start time
5353

5454
2. **Telephone Network** -- In a telephone network the lines have bandwidth, BW. We want to route the phone call via the highest BW.
55-
56-
55+
56+
5757
----------------------------------------------
5858
**Source**
59-
59+
6060
[Wikipedia](https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm)
61-
61+
6262
[Dijkstra](http://www.csl.mtu.edu/cs2321/www/newLectures/30_More_Dijkstra.htm)

Diff for: Competitive Coding/Sorting/README.md

+23-3
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,35 @@ __Properties__
7575
* Best case performance O(n log n)
7676
* Average case performance depends on gap sequence
7777

78-
####Radix Sorting
79-
From [Wikipedia](https://en.wikipedia.org/wiki/Radix_sort): radix sort is a non-comparative integer sorting algorithm that sorts data with integer keys by grouping keys by the individual digits which share the same significant position and value. A positional notation is required, but because integers can represent strings of characters (e.g., names or dates) and specially formatted floating point numbers, radix sort is not limited to integers. Radix sort dates back as far as 1887 to the work of Herman Hollerith on tabulating machines.
78+
###### View the algorithm in [action](https://www.toptal.com/developers/sorting-algorithms/shell-sort)
79+
80+
### Heap
81+
![](https://upload.wikimedia.org/wikipedia/commons/4/4d/Heapsort-example.gif)
82+
83+
From [Wikipedia](https://en.wikipedia.org/wiki/Heapsort): Heapsort is a comparison-based sorting algorithm. Heapsort can be thought of as an improved selection sort: like that algorithm, it divides its input into a sorted and an unsorted region, and it iteratively shrinks the unsorted region by extracting the largest element and moving that to the sorted region. The improvement consists of the use of a heap data structure rather than a linear-time search to find the maximum.
84+
85+
__Properties__
86+
* Worst case performance O(n log n)
87+
* Best case performance O(n log n)
88+
* Average case performance O(n log n)
89+
90+
###### View the algorithm in [action](https://www.toptal.com/developers/sorting-algorithms/heap-sort)
91+
92+
### Radix
93+
From [Wikipedia](https://en.wikipedia.org/wiki/Radix_sort): Radix sort is a non-comparative integer sorting algorithm that sorts data with integer keys by grouping keys by the individual digits which share the same significant position and value. A positional notation is required, but because integers can represent strings of characters (e.g., names or dates) and specially formatted floating point numbers, radix sort is not limited to integers. Radix sort dates back as far as 1887 to the work of Herman Hollerith on tabulating machines.
8094

8195
__Properties__
8296
* Worst case performance O(wn)
8397
* Best case performance O(w + N)
8498
* Average case performance depends on gap sequence
8599

86-
###### View the algorithm in [action](https://www.toptal.com/developers/sorting-algorithms/shell-sort)
100+
### Counting
101+
From [Wikipedia](https://en.wikipedia.org/wiki/Counting_sort): Counting sort is an algorithm for sorting a collection of objects according to keys that are small integers; that is, it is an integer sorting algorithm. It operates by counting the number of objects that have each distinct key value(k: max key value), and using arithmetic on those counts to determine the positions of each key value in the output sequence.
102+
103+
__Properties__
104+
* Worst case performance O(n + k)
105+
* Best case performance O(n + k)
106+
* Average case performance O(n + k)
87107

88108
### Time-Compexity Graphs
89109

Diff for: Sun.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pi=3.1415926535897931

Diff for: __init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import Sun

0 commit comments

Comments
 (0)