Comments (3)
Your implementation is quite similar to this:
https://github.com/Laakeri/contestlib/blob/master/src/string/z.cpp
Still, I'm not sure whether it's a good idea to include an implementation in the book, or should the reader try to understand and implement the algorithm?
from cphb.
That is a good question, and should be up to you as the author. I noticed that some of the chapters in the book do have sample implementations and some don't, so I don't know where the line should be (or is) drawn. I do remember though that back when I was studying I initially struggled with writing Z-algorithm the "long way" (which is taught in quite a few online tutorials) and it made the algorithm seem relatively complex and tricky to implement. Coming up with a concise implementation made the algorithm look much simpler and understandable, and to have less room for errors.
I personally think it would make the chapter "easier" for the reader, but I guess this is more of a philosophical question about the goals of the book - and the question that if we add this implementation, do we need to add one for each chapter.
Feel free to close the issue if you feel like it's up to the reader to come up with the implementation.
As a sidenote, I'd also suggest adding a README.MD this repository at some point in the future with a contribution guide and perhaps notes about your plans and vision for the book. For example a lot of people in the Codeforces thread asked about having tasks related to each chapter, so a readme could be a good place to make those kinds of questions clear.
from cphb.
Currently the book contains implementations for some algorithms when there is a short and clever implementation that may be difficult to come up with. Indeed, the short implementation of the Z-algorithm could also be one such implementation.
It is good to keep this issue open and decide later what to do.
from cphb.
Related Issues (20)
- A few humble suggestions
- Chapter 03: Typo at lines 90-91 HOT 1
- sheduling HOT 1
- Updated pdf HOT 2
- Citation of this book HOT 1
- Chapter 13: Bellman-Ford negative cycle example
- Is this book available in print? HOT 2
- Update PDF link on https://cses.fi/book/index.php
- Time complexity to generate table for logK lookup of K succesor of node n HOT 1
- Search Code on Page 47 is unnecessarily confusing
- Suggestion for Section - 5.4 Pruning the Search HOT 2
- Chapter 15: Minor Typo in Footnote HOT 1
- Update definition of "Maximum subarray problem"
- Can't compile with `latexmk`
- Bellman-Ford example has a typo HOT 1
- Errors in Chapter 13 HOT 1
- 21.3 Logic needs an explanation
- [Suggestion] Add a 5th number of the arithmetic sum example
- Since this book is paired with cses.fi, more string algorithms should be mentioned (Aho Corasick, suffix automaton, KMP)
- Bubble sort code typo
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cphb.