Encora Academy πŸ€“

Lu
6 min readJan 11, 2021

Your Personal Branch πŸ’ͺ🏼

Learning journal β€” Week 15 takeaways

by Mayra Lucero GarcΓ­a RamΓ­rez

5/01/2020–11/01/2020

New year and new phase βš™οΈπŸ’ͺ🏼.

This new week started a little intense, after coming back from a brief vacation I had my evaluation interview. I am not sure if it went well at all. But something I can share with you is that I learned a lot about what I have to relearn, learn, and investigate. And a lot of that result in what I learned this week (or relearned).

I will show you some of the notes I did about what I read, practice and learned this week.

Arrays & Lists πŸ“Š

I did a recap of arrays and lists, I discovered their principal differences mostly about performance.

ARRAYS are good reading (because of indexes) but are very bad at inserting and deleting because of the memory management (insert in contiguous memory and the movement of all the elements when deleting).

Lists are, on the contrary, good for insertions and deletions, because all that is needed to modify are the pointers (assuming you already are in the position to do these operations). Nevertheless, very bad at reading as you have to iterate through every node to get to the next, and the next until get to the one you are searching for.

Search πŸ”Ž

I also did a recap of binary search, I had some steps a little mixed. But what I consider fundamental of this search is that:

  • it takes a sorted array
  • takes the searched item
  • returns the position of the item
  • its functionality consist of (taking the lower bound in 0 initially and the upper bound to the number of elements β€” 1):

1 .- taking the element in the middle

2 .- check if it is the element searched for

3 .- if it is, return the index

4 .- if it is not and the value in the position is greater than the value searched for, it moves the upper bound to the current position β€” 1 (so, the previous element)

5 .-if it is not and the value in the position is lower than the value searched for, it moves the lower bound to the current position +1 (so the next element is now the lower bound)

it repeats (and in consequence divides the arrays in 2 subsequently) until it finds the element and returns its index or the lower bound is greater than the upper and returns -1.

Recursion & stacks πŸ“₯πŸ“€

Recursion is a basic concept to understand in CS, it is also very useful in implementations.

The 2 elements of a recursive function are the base case (that one that avoids an infinite loop)

and the recursive case (the one that calls the same function again)

I did a recap of the stack, its basic actions (push and pop), and how a call stack is used internally in the computer to execute functions.

Sorting πŸ—‚

This subject, as the search, was a little unclear in my head, to be honest, I had some concepts of search and sorting mixed up.

I am looking more closely at the merge sort algorithm but this is what I have been learning until now.

Selection sort is where you compare all with everyone, and it takes a lot of time O(nΒ²)

Quicksort picks a pivot and separates the smaller and greater elements in comparison with it.

Then in these two new arrays do the same and so on, until they get to have just one or zero elements, everything will be sorted by this point. The only thing left is to join the result.

Hash Tables & Hash functions πŸ”

I consider this data structure is one of the most useful because of its performance.

A hash table is a combination of a hash function and an array. The great read performance of the array.

But what is a hash function? (and was one of the questions of my evaluation interview)

A hash function is a function that has a string as an input and a number as an output. Hash tables use this to calculate the index where data will be stored in the array (nice, right?).

The reason for this is because a hash function has 2 characteristics, it is consistent (always has the same result with the same input) and it returns different results to different words. This means we can use a hash function to calculate the index of a value that is being inserted and also use it to find it.

Hash functions can have collisions, (the same index returned for different values) this depends on a lot of things and can be avoided with a good hash function and a list embedded in the array.

Big O ❀️

I had this, not fight, but resistance to the big O notation, mostly because every time I tried to learned it I ended up more confused. I read this topic on the Cracking the coding interview and Grokking Algorithms. I can finally say that I understand it, not an expert, but I am getting my hands on to see the different scenarios, cases, and analyze them. I needed this topic to understand all the data structures and their performances so this has been a blast.

Besides, I recap what is:

  • hoisting in JS: It refers to how the execution context works in JS. It consists of the steps where memory is allocated for the variables and functions, this allows us to use a function even if it was declared after it was called.
  • a classLoader in Java: It is a class dedicated to putting other classes in memory according to the needs of the JVM. There are 3 types, application, extension, and bootstrap, being the bootstrap one, the parent of the others and this particular one is found in the JVM core.
  • memory hierarchy
https://computerscience.chemeketa.edu/cs160Reader/_images/Memory-Hierarchy.jpg

Moreover, I have been applying what I learned in my courses of JS and algorithms in the phase problems of HackerRank, besides I have been uploading my progress to GitHub.

I learned a couple of more things, I have been reading the Cracking the coding interview, I will be dedicating an especial post to it at the end of the phase. What I can say until now is that an interview (and cracking it) has a lot of steps, a lot of reflections, I never thought about, what your projects say about you, the situations, years, knowledge, personality. Finally, one part of the book that made me think, what to ask when interviewers give you the opportunity.

Thanks for reading!

--

--

Lu

Hi everyone I am Lucero Garcia πŸ‡²πŸ‡½. DEV πŸ–₯πŸ€“. I also translate articles to Articulos en espaΓ±ol in medium.com/art%C3%ADculos-en-espa%C3%B1ol