Marcello La Rocca

+ Follow
since Sep 01, 2021
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Marcello La Rocca

Campbell Ritchie wrote:

Marcello La Rocca wrote:Thanks . . .

Thank you for coming here to discuss your book

It's been a true pleasure, I enjoyed all the questions, and the chance to talk about algorithms and the book
1 week ago
Thanks to you Jeanne for having me here!
And congrats to the winners, I hope you will enjoy the book

If you aren't among the lucky ones, and you are still interested in reading the book, we would like to share this promotion code that will get you a 40% discount on all versions of Advanced Algorithms and Data Structure.
On the cart page on Manning's website, use the code lalarocca40 to get the discount.

1 week ago
You are welcome!
2 weeks ago

Mohammed Sardar. wrote:Hi Marcello,
My hearty congratulations to you on the Advanced Algorithms and Data Structures. Hope you're doing very well?

Hi Mohammed, thanks a lot!

Interesting considerations: I tend to agree, newer programming languages are increasingly designed to be more high-level (you can think about the long path from Assembler, to C, then Smalltalk/Java, and now Scala, Nim, Go: what was an advanced construct in a previous generation, is included even in the language in languages of the next generations).

So to answer your questions:
1: is my book compatible with modern languages? I think it is, our idea is to make it work with all languages. Because...
2. ... because we are using pseudocode, not a specific language, and we focus on the logic of the DSs and algorithms, not the quirks of the implementation in a specific language.

However, if you'd like to see some of those algorithms implemented in modern languages, check out the book's repo:
I implemented them in fairly modern languages (Java, Python, JavaScript) and I hope to add some Scala implementations soon.

I hope this does answer your questions, but please feel free to ask away, if there is still something unanswered or if you have follow-ups!
2 weeks ago

Kristian Jacobs wrote:Hello Marcello,

Kristian Jacobs wrote:
Good luck with your new book!

Hi Krisz, thanks for your question and for the good wishes!

Kristian Jacobs wrote:
Is the book helps to understand algorythms better in depth vs. Breadth?

I belive yes, but how?

Yes indeed, in chapter 14 we explain both algorithms and try to explain how they work and where you should use one instead of the other. How? Well, we try to show real examples of situations where you want to use either (and other algorithms too, like Dijkstra and A*).

Kristian Jacobs wrote:
What is a good approach to really understand and learn algorythm deeply?

So yeah, I'd pretty much go with Campbell's advice here.

- Read about an algorithm
- Try it out with some example values, like on paper, to check your understanding of the steps
- Once you are confident, try to implement it in a language you are comfortable with
- Write tests for the cases you tried on paper, and maybe for the examples provided with the explanation you read (to have a baseline). Then try to find other edge cases that might challenge your implementation (remember the rule: "none, one, many"...)
- Share your code or find a challenge (leetcode, codewars and similar) that can be solved using this algorithm. This is useful both to better understand how it's used, and to further test your implementation.
- Optionally, try to improve the performance of your implementation: run some profiling to understand the pain points and where i could be improved.
2 weeks ago

Cosimo Damiano Prete wrote:

Marcello La Rocca wrote:

Thanks Cosimo!
Yes indeed, we do cover some of the basics:
- Appendix C (and partly appendix D) is an introduction to basic DSs, from arrays versus lists, to hashing. It's not as in-depth as the rest of the book, but it's enough to get started.
- Appendix E is an intro to recursion
- Appendix F gives a brief summary of randomized algorithms and metrics (in particular for classification)


Do you present and explain for every algorithm its complexity (in terms of big O) and the same for the operations provided by a particular data structure?

Yes indeed - as Campbell said, both running time and space. Also, when possible and useful, we present comparative analysis of these values across different data structures (for instance, the running time of dictionary operations for arrays, binary search trees, hash tables etc...)
2 weeks ago
Hi Alric,
interesting question... is that a homework?

Just to be sure I understand the requirements, the goal for the system is to keep the room temperature between TempMin and TempMax, or as close as possible to SA?
From the description I thought it was the former, but from your flowchart I have a doubt that it seems the latter.
Also, as Tim said, there are a few issues that you could fix around the "T<SA" decision block. And I'd definitely second Tim's suggestion to introduce a tolerance area to avoid the system flipping on and off (depending on the answer to my first questions, you could do it in different ways, of course).
2 weeks ago

Pramod Patki wrote:Hello Marcello,

Welcome to ranch!
I am curious to know if there is one programming language used in book or multiple?
I tried to find it from contents on manning website’s book provided here but couldn’t find it or missed it 😊

Wish you great success and many more good books like this to come.

Pramod Patki

Hi Pramod,
thanks a lot for your question and for the compliments and good wishes! I really appreciate it
So yes, as Nestor and Junilu (thanks!) already mentioned, the book uses pseudocode. That was decided to try to abstract away all the implementation details that are tied to any specific programming language, and let the readers focus on the logic of the algorithms.

There are a couple of exceptions: chapter 2 shows some Python while talking about profiling, chapter 7 uses Java to explain locks, and appendix E uses JavaScript to show how recursion works.
Besides that, for all chapters there is an implementation in at least one of these three languages, shared on the book's GitHub repo, here:

2 weeks ago

Nestor Mata wrote:Hi Marcello,

Welcome, and first of all, let me congratulate you on getting out a book that seems so interesting and necessary, this kind of book makes me really excited. It must have to be a lot of work to get it done.

Does any of the algorithms in the book are for elastic/cloud computing?

Looking forward to getting this book.

Best regards,

Hi Nestor, thanks a lot for your message and your warm welcome!
I hope the book will live up to your expectations It was, indeed, a loooooooot of work, it took me some 5 years to write it, from the first pitch to the editor to the printed version.

So... most of the book abstracts the environment/computational model, so it doesn't address specifically cloud computing. Chapter 13 is the exception, because it focuses on distributed computing and MapReduce, in particular discussing distributed versions of 3 clustering algorithms.

If you'd like to read more about algorithms in elastic/cloud computing, I totally suggest this book:
Maybe just check the ToC to see if the topics match what you'd like to read, but other than that, you can count on the book to be really well written.
2 weeks ago

Pramod Patki wrote:Welcome to ranch Marcello

Thanks Pramod!
2 weeks ago

Cosimo Damiano Prete wrote:

Hi Marcello.
All that sounds really interesting.

Do you cover basic A&DS as well (e.g., in an introduction or so)?

- Cosimo

Thanks Cosimo!
Yes indeed, we do cover some of the basics:
- Appendix C (and partly appendix D) is an introduction to basic DSs, from arrays versus lists, to hashing. It's not as in-depth as the rest of the book, but it's enough to get started.
- Appendix E is an intro to recursion
- Appendix F gives a brief summary of randomized algorithms and metrics (in particular for classification)

2 weeks ago

Ayoub Rossi wrote:Hi,

I am wondering if algorithms and data structures are really used in the field.

Me myself, have always liked to learn about those but the only place where I can really make use of them is on platforms like Leetcode and Hackerrank.

Of course coding interviews at big tech companies require knowledge about those too but what about the project you work on every day?


I work as a software engineer on Java Web Applications ( Spring )

Thanks for your question Ayoub, that's a very good point.
Yes, indeed, algorithms are vastly used in real world, every-day work. Of course that's more true for some positions, while for other jobs it might be an exception rather than something you deal with every day.
For instance, R&D is a (sub)field where you are likely to have to deal on a regular basis with advanced algorithms and DSs, and you probably would need to know their ins and outs.
As a backend engineer focusing on web applications, you might have the chance to use some of these algorithms every so often to improve the performance, or memory usage, of the applications you write.

In my experience, knowing the basics is very important: once can harm the performance of a web application very easily by misusing lists, maps and priority queues already (I can provide a few examples, if you are interested).
You won't probably need Dijkstra, but for example I'm working right now on a project, in the area of ecommerce, that requires some knowledge about graphs and implementing a custom version of DFS.

Junilu Lacar wrote:I just had a quick look at the book contents and it does look like the author gave real-world examples of how these algorithms can be applied. Many of them, like Bloom filters, are used widely. I'll leave it to our guest author to give you a more comprehensive answer but the short of it is, yes, algorithms and data structures are used all the time even though you may not be aware of them.

Thanks Junilu! Yes indeed, we tried to provide examples of real-world applications for all the algorithms that we discussed in the book: for instance, just in the first few chapters, we deal with a tool to handle tasks/bugs, an e-commerce system, a rudimentary warehouse management etc...
And I tried to go even further, discussing techniques and best practices to take decisions when implementing these solution, from design to profiling.
2 weeks ago

Cosimo Damiano Prete wrote:
Also, I had a look at the index of the book and many "use cases" are more related to AI than to data structures to my knowledge.
How does the book tackle them? Is the focus kept on the A&DS or does it shift a lot on those topics (e.g.: genetic algorithms) as well?

Thanks and hear you soon,
- Cosimo

Hi Cosimo, thanks for your question!
Well, many data structures are used in AI, but I'd argue that doesn't make them fall exclusively in that field.
If anything I'd argue that is AI (here meant like ML) that is used a lot to solve some of the same problems for which these DSs are used.
You mention, for example, genetic algorithms: those are used a lot in optimization problems, but not necessarily in AI or ML. They have been used a lot to find approximate solutions to NP-complete and NP-hard problems, or for instance they were the first really successful technique to tackle protein folding. Which is now best solved using deep-learning (AlphaFold)

To answer your last question, I'd say the focus of the book is mostly on the A&DSs, but even more on the problems that they can help solving.
There are, however, a couple of chapters that are heavily focused on AI/ML: chapters 12 and 13, mostly about unsupervised learning and clustering.
2 weeks ago

Sharma Ashutosh wrote:What's extra in this book compared to other Data structures and Algorithms books?

Thanks for your question Sharma!
I'd say that the main trait of this book, so that we tried (hard) to build a bridge between textbooks and "hands-on", practical guides. My idea was to build each chapter in layers, and let the reader go as far as needed and desired: so we first talk about a problem, then show possible solutions to it, next introduce a data structure that can solve it in a better way, and show how to use it for this purpose. For the interested readers, we then proceed to explain the internals of the algorithm/data structure, explain how they work, and possibly talk about the math behind it (when it's appropriate).
The main focus of each chapter is to show practical problems that you can find in your daily job, or anyway in the real world (not just theoretical teasers for interviews/challenges) and show different ways to solve them. Then if you want to delve further, you can learn how these DSs work.

Sharma Ashutosh wrote:Does it talk about stable algorithm?

How do you mean? Stable sorting algorithms? We don't explain those explicitly, but if I'm not mistaken stable sorting is mentioned a couple of times (also explaining why it's needed, when it is)

Sharma Ashutosh wrote:Does it talk about modern day algorithm being used at Big tech? Like the algorithm that was discussed during Facebook whistleblower testimony in Washington D.C.?

It does discuss algorithms used at big tech companies (well, I can swear I used some of them in such companies ), but not that kind of algorithms.
If you are referring, as I think, to the algorithms that are used to make recommendations and promote content to the users, those are usually complex ensembles that leverage several of the techniques described in the book (and many others not there, but that you can find for example in this great book by Luis Serrano:
It does explain some foundational techniques and programming models, like MapReduce, or clustering, or gradient descent (used as the optimization technique behind supervised learning models)

Sharma Ashutosh wrote:Thanks in advance.

It's a pleasure, thanks to you for asking these questions!
2 weeks ago

Campbell Ritchie wrote:What's a soft heap? Is it one where inactive objects are automatically deleted?

A soft heap is a really advanced data structure. It's an approximate priority queue, for which you can control the error rate: meaning that you trade speed - sub-logarithmic running time - for accuracy of the results returned by methods like top (aka findmin)

It's not on my book, but we discussed about adding it, at some point... it's one of those I'd love to include in a "Seriously Advanced Algorithms and Data Structures" follow up, should we have the chance to write it
2 weeks ago