Sunteți pe pagina 1din 8

Polytechnic University of the Philippines

College of Computer and Information Sciences


Department of Computer Science
Sta. Mesa, Manila

In Partial Fulfillment of the


Requirements for the Subject
COSC 3033: Design and Analysis of Algorithm

Time Complexity Computation of an Algorithm using


Asymptotic Notation

Almeda, Dexter
Bercasio, Charlene
Loto, Renz Ramzel

BSCS 2-1D
Group 1

Prof. Elias Austria


October, 2015

INTRODUCTION

Asymptotic notations are mathematical tools to represent time complexity of algorithms


for asymptotic analysis. The main idea of asymptotic analysis is to have a measure of efficiency
of algorithms that doesnt depend on machine specific constants, and doesnt require algorithms
to be implemented and time taken by programs to be compared. As a tool, asymptotic notations
have been a great help for us students in the complexity computation, that is, manually using
pen and paper. It would be better if that tool could be implemented or computed through an
application.

The Time Complexity Computation of an Algorithm using Asymptotic Notation is an


application that features the implementation of the computational complexity of Asymptotic
Notations using a software, hence, making computation require less effort and time.

BACKGROUND OF THE PROJECT

Normally, the process of computational complexity is like this: Given two functions
(running time) and formulas for different asymptotic notation types, as for this case, three
namely - big O, omega, and theta, we would compute for the positive values of the given
function variable, say for example n and the constant C.

With the use of the application Time Complexity Computation of an Algorithm using
Asymptotic Notation, we aim to implement this process using a software for better output and
lesser cost (time and effort).

PROJECT OBJECTIVES

General Objective:

This project aims to put to use the theories that we learned from our assigned topic Asymptotic
Notations through the creation of a program that manifests the computational complexity computing for the running time.

Specific Objectives:

To implement the Asymptotic Notations algorithm using an application

To create an application for better understanding of Asymptotic Notations

To provide a user-friendly, reliable and useful application for Asymptotic Notations


computational complexity

To lessen the effort and time cost in computational complexity with the use of an
application

ALGORITHM USED

In this project, we will test the suitability of a segment in an algorithm approach to the
solution of the Time Complexity Computation of an Algorithm using Asymptotic Notation. In
order to do this, we will utilize the Java programming language and integrate Graphical User
Interface (GUI) and file handling to come up with a friendly and better environment for the user.
Brute force is the algorithm that the proponents implemented to complete this project. To get
what we need for the computation, particularly the code and the number of inputs. We will then
make use of string matching to identify the code and formulas to compute for the information the
user need, to be exact, the running time. By performing the algorithms, we hope to successfully
benefit the user which is the students and faculty through a user-friendly and helpful program.

SCOPE AND LIMITATION

This paper mainly focuses on the implementation of Asymptotic Notations in computation


of complexity. This involves the computation of the running time from accepting a code or
fragment of source code that must be written in java programming language that we want to find
the running time. The system also doesnt check the syntax of the source code. It can also
handle file that the user can be open, edit and update. Along with file handling, the user is
allowed to input code from a textbox provided. Still, it will undergo the same process.

REVIEW OF RELATED LITERATURE

Asymptotic Notation with Multiple Variables


The running time complexity analysis of algorithms has been traditionally done using
paper-and-pencil proof methods. This technique does not guarantee the accuracy of the
analysis results. It is prone to human error and there is always a risk of forgetting to pen down a
critical assumption besides the proof. Asymptotic notations characterize the limiting behavior of
a function. They are extensively used in many branches of mathematics and computer science
particularly in analytical number theory, combinatorics and computational complexity while
analyzing algorithms. Due to the enormous usage of computational algorithms in safety-critical
domains these days, accuracy of asymptotic analysis has become extremely important. We
propose to use Formal methods, which is a computer based mathematical analysis technique,
to perform asymptotic analysis of algorithms. [1]
Introduction to Algorithms
The running time of an algorithm depends on how long it takes a computer to run the
lines of code of the algorithm. And that depends on the speed of the computer, the programming

language, and the compiler that translates the program from the programming language into
code that runs directly on the computer, as well as other factors. First, we determine how long
the algorithm takes, in terms of the size of its input. The second idea is that we focus on how
fast this function grows with the input size. We call that the rate of growth of the running time.
To keep things manageable, we simplify the function to distill the most important part and cast
aside the less important parts. [2]
Improving the Automatic Evaluation of Problem Solutions in Programming
Determining a problem's asymptotic complexity is important in theoretical computer
science; there are many problems (such as matrix multiplication) whose complexities remain
unknown. Often, a computer scientist will discover an algorithm for a problem and then show
that it is asymptotically optimal; this is usually considered a landmark result in the study of that
problem. Asymptotic analysis is the most frequently used technique to quantify the
performance of an algorithm. Its name refers to the fact that this form of analysis neglects the
exact amount of time or memory that the algorithm uses on specific cases, but is concerned
only with the algorithm's asymptotic behaviourthat is, how the algorithm performs in the limit of
infinite problem size. [3]
Formalization of Asymptotic Notations in Higher-Order-Logic
The study is the first set-theoretic formalization of asymptotic notations in the open
literature and thus allows us to utilize interactive theorem proving in a very interesting new
direction.
The main idea is to model the complexity of the algorithm in higher-order logic and then
reason about its asymptotic bounds using our formalization of asymptotic notations we can
guarantee the accuracy of the analysis. For illustration purposes, we present the analyses of two
algorithms: insertion sort and uniqueness of array elements in this thesis. [4]

Lexical Analysis
Lexical Analysis is a process of analysing a stream of individual characters; normally
arranged as lines, into a sequence of lexical toxens to feed into the parser. The theory of lexers
and parsers are most often used in compiler. The lexical syntax is usually a regular language
with a regular rules consisting of regular expressions which define the set of possible character
sequences that are used to form individual toxens or lexemes. A lexer recognizes strings, and
for each kind, of string found the lexical program takes action, most simply producing a token.
[5]

SCREENSHOTS

BIBLIOGRAPHY
[1]

R. R. Howell. On Asymptotic Notation with Multiple Variables. Technical report,

Dept . of Computing and Information Sciences Kansas State University, Manhattan,KS 66506
USA, January 2008.
[2]

Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and Clifford Stein.

Introduction to Algorithms, Second Edition. MIT Press and McGraw-Hill, 2001


[3]

Ribiero, P. and Guerreiro, P. Improving the Automatic Evaluation of Problem

Solutions in Programming. Olympiads in Informatics, 2009, Vol. 3, 132143.


[4]

Nadeem Iqbal, Formalization of Asymptotic Notations in Higher-Order-Logic,

[5]

Johnson, M. and Zelenski, J. Lexical Analysis. Accessed August 19, 2015

2012