 Data Structures That Make Video Games Go Roundhigh. 2 High variance. Elements are widely distributed between buckets.Open Addressing Hash Maps ● Simplest implementation only require a contiguous block of memory. ● Elements are more densely packed Addressing Hash Maps ● Simplest implementation only require a contiguous block of memory. ● Elements are more densely packed. ● Better cache performance. ● Collisions are resolved via probing. metadata about it’s probe sequence length, PSL and is defaulted to some value. 2. On insert, elements start with a PSL value of 0. 3. PSL of the inserted element is compared to the PSL of the bucket0 码力 | 196 页 | 3.03 MB | 6 月前3 Data Structures That Make Video Games Go Roundhigh. 2 High variance. Elements are widely distributed between buckets.Open Addressing Hash Maps ● Simplest implementation only require a contiguous block of memory. ● Elements are more densely packed Addressing Hash Maps ● Simplest implementation only require a contiguous block of memory. ● Elements are more densely packed. ● Better cache performance. ● Collisions are resolved via probing. metadata about it’s probe sequence length, PSL and is defaulted to some value. 2. On insert, elements start with a PSL value of 0. 3. PSL of the inserted element is compared to the PSL of the bucket0 码力 | 196 页 | 3.03 MB | 6 月前3
 Back to Basics: Classic 9STLSteagall Rationale • Data is almost always collections of elements • A virtually infinite number of data element types • Each collection of elements has some representation • A large number of possible O(1) Independent of number of elements Logarithmic O(log(n)) Increases logarithmically with the number of elements Linear O(n) Increases linearly with the number of elements N-log-N O(n*log(n)) Increases 2021 Bob Steagall Key Principles • Containers store collections of elements • Algorithms perform operations upon collections of elements • Containers and algorithms are entirely independent • Iterators0 码力 | 75 页 | 603.36 KB | 6 月前3 Back to Basics: Classic 9STLSteagall Rationale • Data is almost always collections of elements • A virtually infinite number of data element types • Each collection of elements has some representation • A large number of possible O(1) Independent of number of elements Logarithmic O(log(n)) Increases logarithmically with the number of elements Linear O(n) Increases linearly with the number of elements N-log-N O(n*log(n)) Increases 2021 Bob Steagall Key Principles • Containers store collections of elements • Algorithms perform operations upon collections of elements • Containers and algorithms are entirely independent • Iterators0 码力 | 75 页 | 603.36 KB | 6 月前3
 Modern C++ IteratorsLoop Over Arrays • Two ways to iterate over the elements of an array – Using indexes – Using pointers int arr[] = {10, 20, 30, 40}; // iterate over elements with index: for (int i = 0; i < 4; ++i) { std::cout std::cout << arr[i] << '\n'; } // iterate over elements with pointer: for (int* p = arr; p < arr + 4; ++p) { std::cout << *p << '\n'; } Output: 10 20 30 40 10 20 30 40 30 40 10 20 arr: arr arr+2 josuttis.com 5 C++ Iterators: Generalization of Pointers that Iterate • Iterate like a pointer over elements – From begin() til end() std::vector Modern C++ IteratorsLoop Over Arrays • Two ways to iterate over the elements of an array – Using indexes – Using pointers int arr[] = {10, 20, 30, 40}; // iterate over elements with index: for (int i = 0; i < 4; ++i) { std::cout std::cout << arr[i] << '\n'; } // iterate over elements with pointer: for (int* p = arr; p < arr + 4; ++p) { std::cout << *p << '\n'; } Output: 10 20 30 40 10 20 30 40 30 40 10 20 arr: arr arr+2 josuttis.com 5 C++ Iterators: Generalization of Pointers that Iterate • Iterate like a pointer over elements – From begin() til end() std::vector- v{10, 20, 30, 40, 50, 60, 70}; for (std::vector - ::iterator 0 码力 | 24 页 | 1.93 MB | 6 月前3
 Taming the C++ Filter View// print first three elements print(std::views::take(coll2, 3)); // print first three elements print(coll1 | std::views::take(3)); // print first three elements print(coll2 | std::views::take(3)); std::views::take(3)); // print first three elements print(coll2 | std::views::take(3) | std::views::transform([](auto v){ return std::to_string(v) + 's'; })); Output: 0 8 15 47 11 42 1 0 1 8 11 15 42 47 0 Josuttis C++ Filter View @cppcon 2024-09-17 5©2024 by josuttis.com 11 C++ Using a Pipeline to Modify Elements auto vNotEmpty = std::views::filter([] (const auto& rg) { return !rg.empty(); }); std::vector0 码力 | 43 页 | 2.77 MB | 6 月前3 Taming the C++ Filter View// print first three elements print(std::views::take(coll2, 3)); // print first three elements print(coll1 | std::views::take(3)); // print first three elements print(coll2 | std::views::take(3)); std::views::take(3)); // print first three elements print(coll2 | std::views::take(3) | std::views::transform([](auto v){ return std::to_string(v) + 's'; })); Output: 0 8 15 47 11 42 1 0 1 8 11 15 42 47 0 Josuttis C++ Filter View @cppcon 2024-09-17 5©2024 by josuttis.com 11 C++ Using a Pipeline to Modify Elements auto vNotEmpty = std::views::filter([] (const auto& rg) { return !rg.empty(); }); std::vector0 码力 | 43 页 | 2.77 MB | 6 月前3
 julia 1.10.10. . . . 1366 79 Markdown 1372 79.1 Inline elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1372 79.2 Toplevel elements . . . . . . . . . . . . . . . . . . . . . . For example, 0 .< A .< 1 gives a boolean array whose entries are true where the corresponding elements of A are between 0 and 1. Note the evaluation behavior of chained comparisons: julia> v(x) = (println(x); iterator (see Iteration interface) at least as long as the number of variables on the left (any excess elements of the iterator are ignored). This can be used to return multiple values from functions by returning0 码力 | 1692 页 | 6.34 MB | 3 月前3 julia 1.10.10. . . . 1366 79 Markdown 1372 79.1 Inline elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1372 79.2 Toplevel elements . . . . . . . . . . . . . . . . . . . . . . For example, 0 .< A .< 1 gives a boolean array whose entries are true where the corresponding elements of A are between 0 and 1. Note the evaluation behavior of chained comparisons: julia> v(x) = (println(x); iterator (see Iteration interface) at least as long as the number of variables on the left (any excess elements of the iterator are ignored). This can be used to return multiple values from functions by returning0 码力 | 1692 页 | 6.34 MB | 3 月前3
 Julia 1.10.9. . . . 1366 79 Markdown 1372 79.1 Inline elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1372 79.2 Toplevel elements . . . . . . . . . . . . . . . . . . . . . . For example, 0 .< A .< 1 gives a boolean array whose entries are true where the corresponding elements of A are between 0 and 1. Note the evaluation behavior of chained comparisons: julia> v(x) = (println(x); iterator (see Iteration interface) at least as long as the number of variables on the left (any excess elements of the iterator are ignored). This can be used to return multiple values from functions by returning0 码力 | 1692 页 | 6.34 MB | 3 月前3 Julia 1.10.9. . . . 1366 79 Markdown 1372 79.1 Inline elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1372 79.2 Toplevel elements . . . . . . . . . . . . . . . . . . . . . . For example, 0 .< A .< 1 gives a boolean array whose entries are true where the corresponding elements of A are between 0 and 1. Note the evaluation behavior of chained comparisons: julia> v(x) = (println(x); iterator (see Iteration interface) at least as long as the number of variables on the left (any excess elements of the iterator are ignored). This can be used to return multiple values from functions by returning0 码力 | 1692 页 | 6.34 MB | 3 月前3
 Julia 1.11.5 Documentation. . . . 1598 81 Markdown 1605 81.1 Inline elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1605 81.2 Toplevel elements . . . . . . . . . . . . . . . . . . . . . . For example, 0 .< A .< 1 gives a boolean array whose entries are true where the corresponding elements of A are between 0 and 1. Note the evaluation behavior of chained comparisons: julia> v(x) = (println(x); iterator (see Iteration interface) at least as long as the number of variables on the left (any excess elements of the iterator are ignored). This can be used to return multiple values from functions by returning0 码力 | 2007 页 | 6.73 MB | 3 月前3 Julia 1.11.5 Documentation. . . . 1598 81 Markdown 1605 81.1 Inline elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1605 81.2 Toplevel elements . . . . . . . . . . . . . . . . . . . . . . For example, 0 .< A .< 1 gives a boolean array whose entries are true where the corresponding elements of A are between 0 and 1. Note the evaluation behavior of chained comparisons: julia> v(x) = (println(x); iterator (see Iteration interface) at least as long as the number of variables on the left (any excess elements of the iterator are ignored). This can be used to return multiple values from functions by returning0 码力 | 2007 页 | 6.73 MB | 3 月前3
 Julia 1.11.6 Release Notes. . . . 1598 81 Markdown 1605 81.1 Inline elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1605 81.2 Toplevel elements . . . . . . . . . . . . . . . . . . . . . . For example, 0 .< A .< 1 gives a boolean array whose entries are true where the corresponding elements of A are between 0 and 1. Note the evaluation behavior of chained comparisons: julia> v(x) = (println(x); iterator (see Iteration interface) at least as long as the number of variables on the left (any excess elements of the iterator are ignored). This can be used to return multiple values from functions by returning0 码力 | 2007 页 | 6.73 MB | 3 月前3 Julia 1.11.6 Release Notes. . . . 1598 81 Markdown 1605 81.1 Inline elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1605 81.2 Toplevel elements . . . . . . . . . . . . . . . . . . . . . . For example, 0 .< A .< 1 gives a boolean array whose entries are true where the corresponding elements of A are between 0 and 1. Note the evaluation behavior of chained comparisons: julia> v(x) = (println(x); iterator (see Iteration interface) at least as long as the number of variables on the left (any excess elements of the iterator are ignored). This can be used to return multiple values from functions by returning0 码力 | 2007 页 | 6.73 MB | 3 月前3
 Julia 1.11.4. . . . 1598 81 Markdown 1605 81.1 Inline elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1605 81.2 Toplevel elements . . . . . . . . . . . . . . . . . . . . . . For example, 0 .< A .< 1 gives a boolean array whose entries are true where the corresponding elements of A are between 0 and 1. Note the evaluation behavior of chained comparisons: julia> v(x) = (println(x); iterator (see Iteration interface) at least as long as the number of variables on the left (any excess elements of the iterator are ignored). This can be used to return multiple values from functions by returning0 码力 | 2007 页 | 6.73 MB | 3 月前3 Julia 1.11.4. . . . 1598 81 Markdown 1605 81.1 Inline elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1605 81.2 Toplevel elements . . . . . . . . . . . . . . . . . . . . . . For example, 0 .< A .< 1 gives a boolean array whose entries are true where the corresponding elements of A are between 0 and 1. Note the evaluation behavior of chained comparisons: julia> v(x) = (println(x); iterator (see Iteration interface) at least as long as the number of variables on the left (any excess elements of the iterator are ignored). This can be used to return multiple values from functions by returning0 码力 | 2007 页 | 6.73 MB | 3 月前3
 Julia 1.12.0 RC1. . . . 1659 83 Markdown 1666 83.1 Inline elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1666 83.2 Toplevel elements . . . . . . . . . . . . . . . . . . . . . . For example, 0 .< A .< 1 gives a boolean array whose entries are true where the corresponding elements of A are between 0 and 1. Note the evaluation behavior of chained comparisons: julia> v(x) = (println(x); iterator (see Iteration interface) at least as long as the number of variables on the left (any excess elements of the iterator are ignored). This can be used to return multiple values from functions by returning0 码力 | 2057 页 | 7.44 MB | 3 月前3 Julia 1.12.0 RC1. . . . 1659 83 Markdown 1666 83.1 Inline elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1666 83.2 Toplevel elements . . . . . . . . . . . . . . . . . . . . . . For example, 0 .< A .< 1 gives a boolean array whose entries are true where the corresponding elements of A are between 0 and 1. Note the evaluation behavior of chained comparisons: julia> v(x) = (println(x); iterator (see Iteration interface) at least as long as the number of variables on the left (any excess elements of the iterator are ignored). This can be used to return multiple values from functions by returning0 码力 | 2057 页 | 7.44 MB | 3 月前3
共 202 条
- 1
- 2
- 3
- 4
- 5
- 6
- 21














 
  
  
 