Pages

Thursday, March 11, 2021

Post #9: Algorithmic design and Data Structure

Algorithmic Design and Data Structure


Explain to another newbie how to apply algorithmic design and data structure techniques

When you start to look at a java program, you need to understand what you want it to look like and what it's going to be used for. For example, a large program will need a search that would be able to go across a larger scale in a smaller amount of time - such as a binary search.

Are some designs better than others? Explain.

In a situation where the computer needs to read, say, 100 contacts and their information, you would likely prefer to use a binary search on their specific social security number. If it's larger than 123-456-7890 than you would be able to split it off between whatever number it was found in and the largest number, otherwise it is either that specific number or in the lower from that number down. This would be a lot better than linear search at this point because the computer only has to search through a small amount of information to get to the place it's looking at.

How would you apply it?

So if I was doing a list of people from 1 - 100 people and I was looking for a person saved between 50 and 100, I would use:

if (NumberYourLookingFor == Numers.get(50)) {
        *Insert code to print off exactly 50*
} else if (NumberYourLookingFor > Numers.get(50)) {
        *Insert code to search for and print for any number between 50 and 100*
} else {
        *Insert code to search for and print for any number between 0 and 50*
}

I would then use a linear search for that route and it would split the workload evenly. A linear search is just the code:

if (NumberYourLookingFor == Numers.get(i)) {
        System.out.println(Numers.get(i));
} else {
        ++i;
}

This basically states that if the number I'm looking for is in the 'i' position of the list, then it will print it off. Otherwise it's going to add 1 to the variable 'i' and search again. Each time it doesn't work it'll continue going until it either finds it or brings back an error.

Thursday, February 11, 2021

Post #8: Java Download

Background Information


This week in class, we got to learn how to download Java and type the program out to make it state "Hello, my name is" and then our name. To do this we were instructed to find a Java IDE to download the correct information into our computers so that we could use it for upcoming classes.


Downloading


The file that I decided to use was an Eclipse downloader - which you can find here. I have to say that I had a bit of trouble finding it as I thought that we were supposed to download a specific one; after searching I found one on Google that was straight forward on how to download it. Just like any computer program, once you told it to download - which was simple enough by clicking a button - it walks you through the steps on how to download the file for Java! After that I was able to get started on the program itself.


Java program


Create a new post where you provide guidance on Java installation and discuss the concepts and features of the object-oriented design principles


Java is used by many people world wide to make computer programs. Because of this, there are multiple tutorials online to teach you how to do specific codes and processes within the IDE so that you can work on different codes. With these tutorials, which can be found within the IDE or online, you can go from never coding before in your life to being an expert at coding within weeks to months - depending on the patience you have.

In my code this time I was instructed to make a code that stated "Hello, my name is" and my name. To do this I downloaded the program linked above and then went to the 'Help' tab at the top. It gave a neat little instruction on how to do the ever-so-famous "Hello World!" code that many people who first start coding first get to experience. Following this instruction, it showed me how to make the project, how to get the code in automatically and then what I needed to type.

In the real world you wouldn't get that kind of assistance that these tutorials explain, but for someone who has just started out and may possibly learn better by being shown how to do it - as there are multiple ways you can learn how to do the same thing - this can be the perfect way to learn the basics of the code so that you can do it on your own later!

Below is my picture of the code that I was able to get to work after multiple tries - as one may be able to notice from the fact that it states this is the second version of said project.

Note the 'Help' tab at the top in the menu bar. That is where there are tutorials that anyone can use right after downloading the IDE program!