Java Programming with Data and Algorithms

 Java Language

Java is a programming language, similar to many other programming languages like Python or C++. Java can be used as a tool to create algorithms and data structures (Shaffer 1.1). Algorithms are used to sort, search, or otherwise assist in organizing information. Data structures act like arrays or lists that help to structure the data in the most effective way possible (Lysecky 1.2). Going over the different methods help the programmer understand which are the best methods of each to use.

Searching Data

Searching data is a way to find information in a list, array, or que. These are simply different types of sets of data. Binary searching is one way to make the computer program more effective at searching. The data list is split into groups, making the groups faster for the computer to search through. Common examples of the binary search are as follows:

                                                                                    

(Geeks 4 Geeks 2022).

The number is being compared to the middle key, or number that is being searched for. In this list, the numbers have been sorted from smallest to largest. The computer knows to look at the middle of the list and if it is larger than that number, to only look at the right side of the data set. If the number is smaller, then only the left side of the data list would be searched.

In small sets like the example above, there may not be a need to be concerned about efficiency. However, imagine a set with millions or maybe more elements to be searched through, and there could be a need to have very complex searching algorithms to find information, else the computer may not be able to handle the time and processing power for the search to be completed.

Sorting Data

Sorting data can also be beneficial in the efficiency of the computer program running the code. In the example above, the data was sorted from least to greatest. Depending on the situation, other methods may need to be used. One great chart from Geeks4Geeks (2022) gives a few examples of different types of sorting:

Algorithms and Choosing Which Algorithm to Use

Algorithms are used to solve a problem. There are many different algorithms available to solve many types of problems. The benefits to using algorithms are:

  • Organization
  • Problem Solving
  • Performance Comparison
  • Reusability (Geeks for Geeks 2023)
Common examples of algorithms would be divide and conquer, where data is split into smaller pieces making parts easier to process, or the Greedy method, where each piece of information is taken as it comes with no regard to efficiency. This article has a great set of different types of algortithms:


Really at the end of the day, the type of problem that is trying to be solved is going to be the determining factor of which algorithm to use. 


References

Algorithms Design Techniques. (2023). Geeks 4 Geeks. Retrieved                                                                     from https://www.geeksforgeeks.org/algorithms-design-techniques/

Lysecky, R., Vahid, F., Lysecky, S., & Givargis, T. (2015). Data Structures Essentials. zyBooks.

Searching Algorithms in Java(November 10, 2022). Geeks 4 Geeks. Retrieved from                                         https://www.geeksforgeeks.org/searching-algorithms-in-java/

Shaffer, C. (March 28, 2013). Data Structures and Algorithm Analysis. Retrieved                                             from https://people.cs.vt.edu/~shaffer/Book/JAVA3elatest.pdf

Comments

Popular posts from this blog

Employee Management System - Simple Project

Explicit and Implicit Variables

Creating Tables in MySQL