Education and Out of The Box Thinking - Linearization of Graham's Scan Algorithm Complexity As Fruit of Education Policy
Education and Out of The Box Thinking - Linearization of Graham's Scan Algorithm Complexity As Fruit of Education Policy
Education and Out of The Box Thinking - Linearization of Graham's Scan Algorithm Complexity As Fruit of Education Policy
ABSTRACT
The question of educational policy is considered with reference to its effect on
student creativity. An example of this effect is presented the linearization of
Grahams scan algorithm. The linearzation is described in detail with reference to
how varying aspects of it originate with the original educational environment.The
Grahams Scan approach to two-dimensional convex hull calculation is considered.
The performance bottleneck is found in the sorting step that precedes the Grahams
Scan scanning operation. Methods are considered to eliminate this bottleneck. The
method chosen is replacing the O(n lg n) sorting algorithm normally used with a
radix sort. To operate within Grahams scan, the radix sort algorithm must be
modified. The main modification is getting it to operate on real numbers. This is
achieved by using the fact that digital computers only operate on a countable and
finite subset of real numbers, and using this fact to reduce the problem of sorting
by real number to sorting by integer. The ramifications of this modification are
taken into consideration in the light of previous theoretical work in this area.
Performance as compared to other algorithms is considered. Further, the
consequences of a proof that the lower bound for the temporal complexity of twodimensional convex hull algorithms is (n lg n) are considered.
Keywords: education, convex hull, Grahams scan, algorithms, complexity
INTRODUCTION
UbiCC Journal
Page 43
www.ubicc.org
UbiCC Journal
GRAHAM-SCAN(Q):
01. if(length(Q) <= 3) return Q
02. p0 := lowest(Q)
03. (t_p1...t_pn) := hsort(Q, p0)
04. (p1...pm) := eliminate((t_p1...t_pn), p0)
05. init(S)
06. push(p0, S)
07. push(p1, S)
08. push(p2, S)
09. for i := 3 to m do
10. while(nonleft(peek(S), top(S), pi) do
11.
pop(S)
12. push(pi, S)
13. return S
Listing 1: Unmodified Grahams Scan
Page 44
www.ubicc.org
UbiCC Journal
Page 45
www.ubicc.org
f : [0,2 ] RF N 0
(1)
a b f (a ) f (b) a, b [0,2 ] RF
In Eq. (1) RF is the set of real numbers which
can be represented in the system of approximation in
question. Given that a fixed-size system of
representation can only represent a fixed number of
distinct numbers, it is possible to construct f by
ordering all possible real representations using the
index of a given input parameter in the resulting list
as the result of f. With this in mind, it is clear that
radix sort can be used to sort by polar angle,
provided an appropriate f is used.
Most modern computers represent real numbers
using floating point, specifically, the IEEE 754
standard. The implementation used in this paper is
based on the double precision IEEE 754 standard as
seen on Figure 1. Double precision floating point
values in this standard can be, provided they are
positive, compared as integers [6].
V = (1) S 2 E EB 1.M
(2)
UbiCC Journal
Page 46
www.ubicc.org
Name
P = { pi | 1 i n}
pi = ( xi , xi2 )
(3)
Complexity,
average
case
Complexity,
worse case
Reference
Gift
Wrapping
Algorithm
O(nh)
O(nh)
[2][4][8]
Grahams
Scan
O(n lg n)
O(n lg n)
[2][3]
Quickhull
O(n lg n)
O(n2)
[9]
Incremental
with
Edelsbrunner
modification
O(n lg n)
O(n lg n)
[10]
Preparata
Hong
O(n lg n)
O(n lg n)
[11]
Chans
Algorithm
O(n lg h)
O(n lg h)
[12]
Grahams
Scan,
modfied
O(kn)
O(kn)
Estimate
Reference
Circular uniform
[3][4]
Square uniform
[4]
Normal
planar
distribution
(lg n)
[3]
Uniform
within
convex polygon
lg n
[3]
UbiCC Journal
Page 47
www.ubicc.org
UbiCC Journal
Page 48
www.ubicc.org
Figure 5: Measured performance with uniform point distribution on the boundary a circle.
UbiCC Journal
Page 49
www.ubicc.org
UbiCC Journal
CONCLUSION
Page 50
www.ubicc.org
ACKNOWLEDGEMENT
This work is financial supported by Ministry of
Science and Technological Development, Republic
of Serbia; under the project number III47003.
Infrastructure for e-learning in Serbia ", 2011-2014.
6
REFERENCES
UbiCC Journal
Page 51
www.ubicc.org