You are on page 1of 9

FORMATO DE GUA DE PRCTICA DE LABORATORIO / TALLERES / CENTROS DE

SIMULACIN PARA DOCENTES

CARRERA: CIENCIAS DE LA COMPUTACIN ASIGNATURA: ESTRUCTURA DE DATOS


NRO. PRCTICA: 1 TTULO PRCTICA: MTODOS DE ORDENACIN BURBUJA
INTEGRANTE(S): SANTIAGO VIZCAINO, ANDRES GUEVARA

1. OBJECT

General object

Determine the correct handling of the bubble sorting method

Specific object

Understand the use of the bubble sorting method.

Detail the operation of the bubble sorting method.

Perform the bubble sorting method

2. THEORETICAL FRAMEWORK

Java is an object-oriented programing language, is independent which means it can be run on


any operating system with any type of processor as long as the java interpreter is available
on the system. (W3schools.in, 2016)

Some of its history start in the early 90s, extending the power of network computing to the
activities of everyday life was a radical vision. In 1991, a small group of Sun engineers called
the "Green Team" believed that the next wave in computing was the union of digital
consumer devices and computers. Led by James Gosling, the team worked around the clock
and created the programming language that would revolutionize our world Java. (Oracle,
2017)

One important part of java is its Java Virtual Machine (JVM) this executes java code, but is
written in platform specific languages such as C/C++/ASM, etc. so JVM is not written in
JAVA and hence cannot be platform independent and Java interpreter is a part of JVM.
(W3schools.in, 2016)

Eclipse, in the late 1990s, IBM began development of what we now know as Eclipse. Today
we see high adoption rates and evidence of successful application of this technology across
the software industry. The purpose of this article is to review the inception of Eclipse, to
illustrate the role it plays in today's development tools, and to convey how we see the
technology evolving over time. (Cernosek, 2005)

Eclipse is a community for individuals and organizations who wish to collaborate on


commercially-friendly open source software. Its projects are focused on building an open
development platform comprised of extensible frameworks, tools and runtimes for building,
deploying and managing software across the lifecycle. The Eclipse Foundation helps
cultivate both an open source community and an ecosystem of complementary products and
services. (Cernosek, 2005)

The Eclipse Project was originally created by IBM in November 2001 and supported by a
consortium of software vendors. The Eclipse Foundation was created in January 2004 as an
independent not-for-profit corporation to act as the steward of the Eclipse community. The
independent not-for-profit corporation was created to allow a vendor neutral and open,
transparent community to be established around Eclipse. Today, the Eclipse community
consists of individuals and organizations from a cross section of the software industry.
(Cernosek, 2005)

Bubble sorting is one of the simplest sorting algorithm that we can use to sort an array or a
structure. Though it is so simple to implement in a C program, bubble sort is also considered
as an inefficient sorting algorithm. Bubble sort comes handy in cases where the total number
of elements to be sorted is so small (may be in the 100s range). When the data size is
large/huge bubble sort is seldom used in practical programming world. Lets analyses bubble
sort algorithm in detail by implementing it as a C program. (Bubble Sort with Java, 2012)

Bubble sort belongs to O(n2) sorting algorithms, which makes it quite inefficient for sorting
large data volumes. Bubble sort is stable and adaptive.
Bubble sort Algorithm compare each pair of adjacent elements from the beginning of an array
and, if they are in reversed order, swap them. If at least one swap has been done, repeat step
1. (Bubble Sort with Java, 2012)

1. DEVELOPMENT OF PRACTICE

Part 1: creating and filling the array

In this part, we must enter the long of the bi-dimensional array, after that we have to
determine which will be the range to class Random is going to use for determining the
numbers inside to the array.

Part 2: ensure to the numbers into the spaces will be different.

We use the loop for to move in the different space into the array. And with the help to random
class the spaces will have a number in each space. In this exercise we don't want to have the
same numbers in the array, so with the following algorithm we will control that the numbers
are not repeated. Since the counter will only increase if the number is different.
Part 3: bubble sorting algorithm

This algorithm Compare each pair of adjacent elements from the beginning of an array and,
if they are in reversed order, swap them. If at least one swap has been done, repeat step 1.

In this case the variable "aux" help us to make the swap.

We use the two for loops to move within the array.

Note: all "System.out.print" statements are used to print the motions that make this algorithm
into a table.

In essence the for loop is what is in red.


Part 4: printing

We use for loops to print the array.

Part 5: desktop test

1)

In this part the program asks the matrix length.

2)

The next thing the program asks is the range of numbers that are going to be in the spaces of
the array.

3)
The box in red indicates the counter of the first loop for which indicates the number of times
to perform the algorithm, this depends on the size of the vector.

The green box gives us the positions of the spaces with which the comparison is to be made.

The space in blue gives us the value that is in the position that the variable j indicates at that
moment.

The space in yellow gives us the value that is in the position that the variable j indicates at
that moment + 1.

The space in brown gives us the value that has taken the variable "aux" having been
exchanged from the position that is in j at that time.

The black box indicates the new value that has been placed in the position that the variable j
indicates at that moment.

The purple box indicates the new value that gives the variable "aux" to the position that
indicates j + 1

The clear blue box indicates the movements that the vector is taking each time there is a
change of value in the positions of the vector.

4)
In this part we can see how the variable "i" its change its value, and all the movement before
explained will occur.

And in the last line we have the algorithm finished, and the numbers ordered in ascending
order from left to right

Part 6: execution

The program do the next things:

1. starts with the value of position 0 of the array


2. compares the value of position 0 of the array with the value of position 0 + 1 of the
array
3. if the value at position 0 + 1 of the array is greater than the value of the position 0
does the exchange
4. The value of position 0 is saved in the variable "aux".
5. The value of position 0 + 1 is stored in position 0.
6. The value of the variable "aux" is stored in position 0 + 1.
7. The value of the variable "j" is increased in each pass.

This loop continues until the condition of the variable "i" is satisfied.
2. RESOURCES USED
In this lab we use the computer with the eclipse program to write the statements, and internet
to search some information of java and eclipse.

3. RESULTS
With this program we got a way to ordinate an array of numbers.
The result of the algorithm is successful, since the numbers are from lowest to highest.

4. CONCLUSIONS
As a result of the practice performed, it is possible to determine that the bubble
method is an easy and fast method to implement when it is desired to do an ordering
of numbers in an array.
On the other hand this Bubble sorting algorithm has a very low efficiency since the
execution times in much larger programs would be a factor against for the use of this
algorithm.
The realization of the test of desktop allows to clarify and to understand more thoroughly
as is the function of any algorithm, and because of this, it becomes a fundamental part of
the programming.

5. RECOMMENDATIONS
When the class is finished, it would be good for the teacher to show us how the correct
algorithm of that practice is.

You might also like