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:
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:
- Organization
- Problem Solving
- Performance Comparison
- Reusability (Geeks for Geeks 2023)
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
Post a Comment