Daniel Zingaro

Author
+ Follow
since Jan 30, 2021
Cows and Likes
Cows
Total received
3
In last 30 days
0
Total given
0
Likes
Total received
5
Received in last 30 days
0
Total given
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Daniel Zingaro

I don't have access to that book, and apologies if I've misunderstood your question, but:

"An integer literal is of type long if it is suffixed with an ASCII letter L or l (ell); otherwise it is of type int"
https://docs.oracle.com/javase/specs/jls/se10/html/jls-3.html#jls-3.10

So if you write just the literal 0, it is an int. If you write 0L, it is a long.

Dan
Thanks, Jeanne  and all!

To anyone who reads the book, please feel free to let me know how you do with it. I'm working on another book now so I'd love to hear your suggestions for improvement.

Thank you all,
Dan
1 year ago
Hi Karina,

Thanks for writing.

Ohhhh yeah, job interview code challenges... those can be rough.

There are books out there designed specifically for the programming interview, so at the risk of losing you, I will say that those are probably worth checking out.

... but if you're still here: I've got a lot of interview topics covered in the book, for sure. And they're presented in a puzzly way, similar to how problems are presented in interviews. Little problems that require some sort of data structure or algorithmic ingenuity/trick. I think if you have some extra time to put toward the book, you'll get a lot faster at these puzzly kinds of algorithms problems.

BTW I like that prime trick. Two numbers larger than the square root can never multiply to the number that seems to be a mainstay in interviews.

Hash tables are a famous interview topic, too. Check out the snowflake problem that I use to start the book (in the sample Chapter 1 that's available).

Dan
1 year ago
Hi German,

Thank you! And, cool blog, BTW I see that you're an author, too, and that you have a C book. I'm using a C book by K.N. King in my courses currently. It's great but getting a little old. I'll check out your book. Perhaps I can write a review!

I like memoization a lot, so it shows up quite a bit in my book. It's my go-to technique for solving dynamic programming problems. If it ends up taking up too much stack space or is too slow then I'll switch to dynamic programming proper. But as I explain in the book, I think it's easier to get all of the indices and bounds right in a memoization version compared to a dynamic programming version. Just my opinion though!

Dan
1 year ago
Hi Dinkar,

Thank you

1. That's a tough question. I don't know the ultimate answer... but for now, I think that books like mine can help train the reader on how to recognize when a data structure is needed. Maybe my book doesn't contain the specific data structure that they need, but hopefully with the background from the book they now know how to find it.

2. I agree! Sometimes we can get locked into a particular area of programming and lose the fundamentals. I don't know if this would be fun for you or others reading, but I really enjoy solving programming puzzles from programming competitions. I'm way too slow to actually compete, but I can compete with myself these puzzles were a major motivator for me to write this book. I've kept writing about new puzzles/exercises to supplement the material in the book... you can check it out if you like:
https://danielzingaro.com/alg

Thank you,
Dan
1 year ago

Jj Roberts wrote:Thanks Dan. I'm particularly interested because I haven't yet had the opportunity to study computer science, and I am thinking that some good beginner books like yours are a good start for now. You're the right person to ask because you teach and write



Thank you! My research area is actually computer science education -- literally studying how to teach this stuff I'll always have more to learn about teaching, of course, but I've tried to pack everything I know about teaching algorithms into this book. For example, I've done research on teaching recursion, dynamic programming, data structures, how students learn this stuff and where they tend to struggle -- and that's informed the material in the book.

Dan
1 year ago

Arjunkumar Shastry wrote:Algorithms are of great importance but everyday do we face these problems? Unless you are developing application or system in initial phase, we are busy mainly maintaining the application or giving support. So people tend to memorize algorithms or data structures for the sake of appearing for interviews!
Do you/your book recommend any hobby projects so that  we keep active interest in this field?



Hi Arjunkumar,

Thank you for writing. A lot of good points by Campbell there, so I'll try not to repeat those.

You've asked a great question. I think that once you start learning about data structures and algorithms, you will see them everywhere. Why is my program so slow? Is this code going to scale to a million users? Is my program correct in all cases -- how do I know?

Personal bias, I know, but I think all programmers need some exposure to algorithms. I don't care so much if someone can implement an algorithm from scratch, more that they can be working on code and notice, "aha wait, can't I just plug Dijkstra's algorithm in here and solve this searching problem lickety-split?"

This is why we put the word 'thinking' in the book. I want people to be able to identify when algorithms might help, and how to think about developing/using algorithms.

As the book explores, the difference between a naive solution and a solution that uses a fast algorithm is shocking. Like, we're talking hundreds or thousands of times faster.

Thank you,
Dan
1 year ago

Kyle Warner wrote:Data Science uses Algorithms to solve problems and evaluate datasets. What would you say are the differences between the topics you cover in your book and one more geared towards data science such as Data Science Bookcamp by Leonard Apeltsin beyond that his books uses Python and you use C?



Hi Kyle,

Thanks for writing.

Uh oh -- looks like you've given me yet another book to check out ;) I hadn't heard of that one. From a quick look, it looks like that book focuses more on large, ill-defined problems that data scientists deal with every day. So it focuses on simulation, visualization, summarization, using preexisting Python libraries, using statistics, etc.

The problems in Algorithmic Thinking are much smaller and more well-defined/not open-ended. Algorithmic Thinking teaches how to build the core algorithms from the ground up, and Data Science Bookcamp looks like it focuses on applying algorithms to data science problems.

Thank you,
Dan
1 year ago
Hi Jj,

Thank you for the welcome!

You're right about my target reader: someone without much knowledge of algorithms and data structures but with knowledge of a programming language.

I think careful study of the book could get someone most of what they'd learn in an intro data structures or algorithms course. What they'd miss is the formal basis of proving correctness and running time, but I've tried to include what the practicing programmer needs there.

It would be fantastic if my book helped people later tackle the, mmm, algorithms books that my students find scary. Maybe those books will be less scary after this

Thank you,
Dan
1 year ago

Sai Hegde wrote:On the same topic... maybe more from an agile project management perspective, how do you go from the ideation of an algorithm to a reasonably optimum solution in a packed sprint??



Hmm, interesting question! I think that some (many? not all, for sure) problems, if read/understood from the perspective of an algorithm designer, have clues that tell you which algorithm to use. I have a section in most chapters to try to distill these clues for the reader.

As for algorithm implementation in a sprint: I'd go for the easiest implementation that uses the algorithm correctly. I don't do much code-level optimization in the book, and often you won't have to because these algorithms are super fast anyway.

What's that saying: don't optimize code unless it truly is a bottleneck? Something like that

Thank you,
Dan
1 year ago

Campbell Ritchie wrote:

Daniel Zingaro wrote:. . . enough storage for half a CD??? . . .

Left half or right half?

Joking aside, thank you for those answers and for answering all the interesting questions people are asking



I'm off topic, wow, but

... a memory just came to me. I remember trying to copy a few songs from my No Doubt CD back in the day, but they were taking up too much space on my hard drive. So I compressed the heck out of them, like down to mono voice quality, all scratchy and barely listenable. To this day when I think about the song Don't Speak I hear that muffled version in my head...

...

Thanks, everyone. Having fun here.
Dan
1 year ago

Adam Do wrote:Hi Daniel!

I'm brand new to the forum as well and I haven't had the time to check out the other questions, so I apologize in advance if you've already answered a similar question.
For computer science students such as myself, how does Algorithmic Thinking stand as an interview prep tool? Should it help with the prep, or is it more of a supplementary tool, or rather an introduction to thinking a certain way?

Thanks so much!



Hi Adam, and welcome!

We're currently using the book in our data structures course here so I think it could serve for that course purpose.

But interview prep... I do cover the standard interview topics (recursion, hash tables, dynamic programming, trees, graphs, breadth-first search, Dijkstra's algorithm, union-find, heaps, binary search, etc.), but it's designed to teach this material for the first time. So if you've seen this material before, a book targeted at interview prep would probably go at a better pace.

I also agree with Campbell that I'm trying to teach people how to think about algorithms in addition to teaching the classics. So it's probably too verbose if anyone here is looking for a night-before-the-interview whirlwind reminder tour.

Thank you,
Dan
1 year ago

Arjunkumar Shastry wrote:Hello Daniel.

Thanks for the great book. This book uses C language so i hope we can use Golang also .
Does book assumes any prerequisites ? like discrete math  etc ?



Hi Arjunkumar and all,

(I really have to learn more about Go.)

No discrete math prereqs here. I kept math to a minimum. No theorems, lemmas, proofs...

At the same time, I wanted the book to be precise.

One of my fears while writing the book was that I'd make it too imprecise for algorithms teachers, but too detailed for practicing programmers. Readers will let me know whether I've managed a balance here. I did ask an algorithms professor to write the foreword for me, and got feedback from competitive programmers, but I'll always need more feedback from new learners.

Thank you,
Dan
1 year ago

Campbell Ritchie wrote:

Daniel Zingaro wrote:. . .  using the wrong data structure is going to grind to a halt. . . .

Hahahahahahaha!



A bit evil, I guess, but hey -- at least readers can't convince themselves that their code is fast enough?

Dan
1 year ago

Sai Hegde wrote:Hi Daniel, Congratulations on the book.
Love the book cover illustration! Should make for a great read.



Thank you!

And anyone who wins or borrows or buys the book, or reads the sample chapter: it would be a privilege to receive any feedback that you had time to send. Especially if you're learning this material for the first time.

Dan
1 year ago