mirror of
https://github.com/TheAlgorithms/Python.git
synced 2026-03-13 09:50:19 +08:00
Simplify code by dropping support for legacy Python (#1143)
* Simplify code by dropping support for legacy Python * sort() --> sorted()
This commit is contained in:
@@ -1,18 +1,16 @@
|
||||
from __future__ import print_function, absolute_import, division
|
||||
|
||||
from numbers import Number
|
||||
"""
|
||||
The convex hull problem is problem of finding all the vertices of convex polygon, P of
|
||||
The convex hull problem is problem of finding all the vertices of convex polygon, P of
|
||||
a set of points in a plane such that all the points are either on the vertices of P or
|
||||
inside P. TH convex hull problem has several applications in geometrical problems,
|
||||
computer graphics and game development.
|
||||
inside P. TH convex hull problem has several applications in geometrical problems,
|
||||
computer graphics and game development.
|
||||
|
||||
Two algorithms have been implemented for the convex hull problem here.
|
||||
Two algorithms have been implemented for the convex hull problem here.
|
||||
1. A brute-force algorithm which runs in O(n^3)
|
||||
2. A divide-and-conquer algorithm which runs in O(n^3)
|
||||
|
||||
There are other several other algorithms for the convex hull problem
|
||||
which have not been implemented here, yet.
|
||||
which have not been implemented here, yet.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
from __future__ import print_function, absolute_import, division
|
||||
|
||||
"""
|
||||
Given an array-like data structure A[1..n], how many pairs
|
||||
(i, j) for all 1 <= i < j <= n such that A[i] > A[j]? These pairs are
|
||||
called inversions. Counting the number of such inversions in an array-like
|
||||
object is the important. Among other things, counting inversions can help
|
||||
(i, j) for all 1 <= i < j <= n such that A[i] > A[j]? These pairs are
|
||||
called inversions. Counting the number of such inversions in an array-like
|
||||
object is the important. Among other things, counting inversions can help
|
||||
us determine how close a given array is to being sorted
|
||||
|
||||
|
||||
In this implementation, I provide two algorithms, a divide-and-conquer
|
||||
algorithm which runs in nlogn and the brute-force n^2 algorithm.
|
||||
|
||||
algorithm which runs in nlogn and the brute-force n^2 algorithm.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user