Skip to content

12.4 typos #206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions data/part-12/4-multidimensional-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ for (int row = 0; row < twoDimensionalArray.length; row++) {
}
```

Nyt tulostus näyttää seuraavalta:
<!-- Nyt tulostus näyttää seuraavalta: -->
The program output is as follows:

<sample-output>

Expand All @@ -111,7 +112,7 @@ Create in the exercise base a method called `public static String arrayAsString(

<!-- Kertaa yhdeksännestä osasta StringBuilderin käyttö ennen tehtävän tekoa. Alla muutamia esimerkkejä metodin odotetusta toiminnasta. -->

Brush up on using StringBuilder in part nine before taking on this exercise. Below there are a few examples of how the method is expected to work.
Brush up on using StringBuilder in part 10.3 before taking on this exercise. Below there are a few examples of how the method is expected to work.

<!-- ```java
int rows = 2;
Expand All @@ -125,7 +126,7 @@ System.out.println(taulukkoMerkkijonona(matriisi));

```java
int rows = 2;
int cols = 3;
int columns = 3;
int[][] matrix = new int[rows][columns];
matrix[0][1] = 5;
matrix[1][0] = 3;
Expand Down Expand Up @@ -325,8 +326,8 @@ We can implement the same functionality using a hash table. Wouldn't a hash tabl

<!-- Kun hajautustaulusta haetaan tietoa tietyllä avaimella, metodin hashCode perusteella selvitetään paikka, mistä tietoa haetaan. Samassa paikassa voi olla useampi value (listassa), jolloin haettavaa avainta verrataan jokaiseen listalla olevaan valueon equals-metodia käyttäen. Kun taulukosta haetaan valuea tietyllä avaimella -- eli indeksillä -- ei vastaavaa toiminnallisuutta tarvitse tehdä. Taulukossa joko on value tai valuea ei ole. Taulukkoon liittyy pieni tehokkuushyöty ohjelman suorituskyvyn kannalta. -->
When we search for a value of a key from a hash table, we use the hashCode method to find the index to search from.
There can be multiple values at the same index (on a list). Then we have to kompare the key we want to find the value for to the key of each key-value pair on the list using the equals method.
When we search for a a value of a key -- or index -- in an array, we do not have to do any of that.
There can be multiple values at the same index (on a list). Then we have to compare the key we want to find the value for to the key of each key-value pair on the list using the equals method.
When we search for a value of a key -- or index -- in an array, we do not have to do any of that.
An array either contains a certain value or it does not, so there is a small performance beneft on using arrays.

<!-- Tämä tehokkuushyöty kuitenkin tulee lisääntyneen virhealttiuden sekä työmäärän kustannuksella. Hajautustauluun on valmiiksi toteutettuna sisäisen taulukon kasvattaminen ja sen toiminnallisuutta on testattu hyvin laajasti. Taulukkoa käytettäessä tällaista etua ei ole -- uutta toiminnallisuutta toteuttaessa saattaa päätyä virheisiin, mikä kasvattaa työmäärää. Virheet ovat toki luonnollinen osa ohjelmistokehitystä. -->
Expand All @@ -335,7 +336,7 @@ Hash tables have tested and proven functionality for increasing the size of the
However, errors are accepted and natural part of software development.

<!-- Kun ajattelemme muistin käyttöä, hajautustaululla voi olla -- tapauksesta riippuen -- pieni etu. Kun taulukko luodaan, muistista varataan heti tila koko taulukolle. Mikäli taulukon jokaiseen indeksiin ei tarvitse lisätä tietoa, on osa tästä tiedosta varattuna turhaan. Hajautustaululla taas tällaista muistin varaamista ei ennakkoon tehdä -- hajautustaulun kokoa kasvatetaan tarvittaessa. -->
When we consider the memory usage, hash table might -- in some situations -- have some benefits.
When we consider the memory usage, hash tables might -- in some situations -- have some benefits.
When an array is created, enough memory for the whole array is allocated for it.
If we do not have values in each element of the array, some of the memory stays unused.
With hash tables this does not happen -- the size of the hash table is increased only when necessary.
Expand Down