ILOCOS SUR POLYTECHNIC STATE COLLEGE
COLLEGE OF COMPUTING STUDIES
MAIN CAMPUS
STACK DATA STRUCTURE
GATCHALIAN, LAURENCE B.
….
….
…
..
…
…
A PROJECT PRESENTED TO THE FACULTY OF
ILOCOS SUR POLYTECHNIC STATE COLLEGE
COLLEGE OF COMPUTING STUDIES
SANTA MARIA, ILOCOS SUR
IN PARTIAL FULFILLMENT
OF THE REQUIREMENTS IN
DATA STRUCTURE AND ALGORITHM COURSE
BACHELOR OF SCIENCE IN INFORMATION TECHNOLOGY
FEBRUARY 2022
1
ILOCOS SUR POLYTECHNIC STATE COLLEGE
COLLEGE OF COMPUTING STUDIES
MAIN CAMPUS
TABLE OF CONTENTS
TITLE PAGE NO.
INTRODUCTION ------------------------ 3
(Data Structure and Algorithm,
Types of Data Structure,
Kinds of Algorithm,
Data Structure Application,
Data Structure Significance)
STACK JAVA IMPLEMENTATION
STACK Brief Discussion
STACK CODE
STACK OUTPUT
ANALYSIS
TREES JAVA IMPLEMENTATION
TREEES Brief Discussion
TREES CODE
TREES OUTPUT
ANALYSIS
SEARCHING ALGORITHM JAVA IMPLEMENTATION
SEARCHING ALGORITHM Brief Discussion
SEARCHING ALGORITHM CODE
SEARCHING ALGORITHM OUTPUT
ANALYSIS
SORTING ALGORITHM JAVA IMPLEMENTATION
SORTING Brief Discussion
SORTING CODE
SORTING OUTPUT
ANALYSIS
GRAPHS JAVA IMPLEMENTATION
GRAPHS Brief Discussion
GRAPHS CODE
GRAPHS OUTPUT
ANALYSIS
TAKE AWAYS / CONCLUSION
REFERENCES
BIOGRAPHICAL SKETCH
2
ILOCOS SUR POLYTECHNIC STATE COLLEGE
COLLEGE OF COMPUTING STUDIES
MAIN CAMPUS
INTRODUCTION
STACK JAVA IMPLEMENTATION
3
ILOCOS SUR POLYTECHNIC STATE COLLEGE
COLLEGE OF COMPUTING STUDIES
MAIN CAMPUS
TREES JAVA IMPLEMENTATION
TREEES Brief Discussion
Detecting similar Java classes using tree algorithms Tobias Sager, Abraham Bernstein, Martin Pinzger, Christoph Kiefer Proceedings
of the 2006 international workshop on Mining software repositories, 65-71, 2006 Similarity analysis of source code is helpful during
4
ILOCOS SUR POLYTECHNIC STATE COLLEGE
COLLEGE OF COMPUTING STUDIES
MAIN CAMPUS
development to provide, for instance, better support for code reuse. Consider a development environment that analyzes code while
typing and that suggests similar code examples or existing implementations from a source code repository. Mining software repositories
by means of similarity measures enables and enforces reusing existing code and reduces the developing effort needed by creating a
shared knowledge base of code fragments. In information retrieval similarity measures are often used to find documents similar to a
given query document. This paper extends this idea to source code repositories. It introduces our approach to detect similar Java
classes in software projects using tree similarity algorithms. We show how our approach allows to find similar Java classes based on an
evaluation of three tree-based similarity measures in the context of five user-defined test cases as well as a preliminary software
evolution analysis of a medium-sized Java project. Initial results of our technique indicate that it (1) is indeed useful to identify similar
Java classes, (2)successfully identifies the ex ante and ex post versions of refactored classes, and (3) provides some interesting
insights into within-version and between-version dependencies of classes within a Java project (Tobias Sager, 2006).
Random trees and applications Jean-François Le Gall We discuss several connections between discrete and continuous random trees.
In the discrete setting, we focus on Galton-Watson trees under various conditionings. In particular, we present a simple approach to
Aldous’ theorem giving the convergence in distribution of the contour process of conditioned Galton-Watson trees towards the
normalized Brownian excursion. We also briefly discuss applications to combinatorial trees. In the continuous setting, we use the
formalism of real trees, which yields an elegant formulation of the convergence of rescaled discrete trees towards continuous objects.
We explain the coding of real trees by functions, which is a continuous version of the well-known coding of discrete trees by Dyck paths.
We pay special attention to random real trees coded by Brownian excursions, and in a particular we provide a simple derivation of the
marginal distributions of the CRT. The last section is an introduction to the theory of the Brownian snake, which combines the
genealogical structure of random real trees with independent spatial motions. We introduce exit measures for the Brownian snake and
we present some applications to a class of semilinear partial differential equations (Gall, 2005).
TREES CODE
class Node {
int data;
Node left, right;
public Node(int item) {
data = item;
left = right = null;
}
}
class BinaryTree {
Node root;
public BinaryTree(int key) {
root = new Node(key);
}
public BinaryTree() {
root = null;
}
public static void main(String[] args) {
BinaryTree tree = new BinaryTree();
// Create the tree
tree.root = new Node(1);
tree.root.left = new Node(2);
tree.root.right = new Node(3);
tree.root.left.left = new Node(4);
tree.root.left.right = new Node(5);
5
ILOCOS SUR POLYTECHNIC STATE COLLEGE
COLLEGE OF COMPUTING STUDIES
MAIN CAMPUS
// Print the tree
printTree(tree.root);
}
public static void printTree(Node node) {
if (node == null) {
return;
}
// Print the node's data
System.out.print(node.data + " ");
// Recursively print the left and right subtrees
printTree(node.left);
printTree(node.right);
}
}
TREES OUTPUT
12453
Process finished.
References
Gall, J.-F. L. (2005). Random trees and applications. Retrieved from project euclid:
https://projecteuclid.org/journals/probability-surveys/volume-2/issue-none/Random-trees-and-applications/
10.1214/154957805100000140.full
Tobias Sager, A. B. (2006). Detecting similar Java classes using tree algorithms. Retrieved from acm dl digital library:
https://dl.acm.org/doi/abs/10.1145/1137983.1138000?
fbclid=IwAR1uORPXRjGO_Y1eYkZUv3loMk4fwArnofEltBqZBxwPwMw53vwtAWEQyJY
6
ILOCOS SUR POLYTECHNIC STATE COLLEGE
COLLEGE OF COMPUTING STUDIES
MAIN CAMPUS
SEARCHING ALGORITHM JAVA IMPLEMENTATION
7
ILOCOS SUR POLYTECHNIC STATE COLLEGE
COLLEGE OF COMPUTING STUDIES
MAIN CAMPUS
SORTING ALGORITHM JAVA IMPLEMENTATION
8
ILOCOS SUR POLYTECHNIC STATE COLLEGE
COLLEGE OF COMPUTING STUDIES
MAIN CAMPUS
GRAPHS JAVA IMPLEMENTATION
9
ILOCOS SUR POLYTECHNIC STATE COLLEGE
COLLEGE OF COMPUTING STUDIES
MAIN CAMPUS
TAKE AWAYS / CONCLUSION
REFERENCES
10
ILOCOS SUR POLYTECHNIC STATE COLLEGE
COLLEGE OF COMPUTING STUDIES
MAIN CAMPUS
BIOGRAPHICAL SKETCH
2*2 PICTURE
11