aboutsummaryrefslogtreecommitdiffstats
path: root/src/lesson40_algo01.cpp
Commit message (Collapse)AuthorAgeFilesLines
* remove trailing whitespaceHEADv0.0.1masterSven Göthel2024-10-131-7/+7
|
* lesson40_*: Resolve midpoint sum overflow, mention std::midpointSven Göthel2024-05-061-3/+7
|
* Review of STL iterator + difference_type limitations (half range) compared ↵Sven Göthel2024-05-031-5/+5
| | | | | | | | | | | | | | | | | to size_t index ops and pointer arithmetic Svenson an I discussed the issue and we were a bit puzzled ;-) So it would have been great to have size_type to be unsigned (ssize_t) to simply constrain and harmonize the whole std::vector (etc) operations. Alternatively, an iterator could have been a pointer type, where such operations are at least tolerated despite similar considerations to ptrdiff_t like void *lo, *hi; lo-hi ! In the meantime, if using iterator and a size, stick to iterator and signed size.
* Resolve clang-tidy warnings=error; Notable std::vector<>: size() -> size_t ↵Sven Göthel2024-05-031-24/+38
| | | | | | | | | | | (unsigned) but iterator and difference_type are signed and losing half of range Because std::vector<>::begin() iterator performs arithmetic using a signed difference_type, we need to use such a signed type here to avoid `bugprone-narrowing-conversions` (LINT) Now, isn't this odd as std::vector<>::size() uses unsigned size_type, aka size_t and mentioned iterator hence lose half the value range possible?
* Adding lesson 40: binary-search *01.cpp, +sorted_insert *02 and quicksort ↵Sven Göthel2024-04-231-45/+156
| | | | *12.cpp, each with optional variations
* Add lesson40: Simple algorithms (starting w/ binary search)Sven Göthel2024-02-251-0/+83