This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Vertices: 8 | |
# Points: 0 | |
# Lines: 0 | |
# Faces: 6 | |
# Materials: 1 | |
o 1 | |
# Vertex list |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ManachersPalindrome | |
{ | |
private readonly char[] s2; | |
private readonly int[] p; | |
public static ManachersPalindrome Build(string s) | |
=> new ManachersPalindrome(s); | |
private ManachersPalindrome(string s) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SuffixTrie | |
{ | |
private TrieNode _root = new TrieNode(); | |
private string _LRS = string.Empty; // Longest repeated substring | |
private SuffixTrie(string value) | |
=> AddWord(value); | |
public static SuffixTrie Build(string value) | |
=> new SuffixTrie(value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Simple specialized container for handling large amounts of linearly moving objects in large spaces. | |
/// Can be used when an Octree or a BVH is too expensive to maintain, if there is a known area of space where AABB queries are concentrated. | |
/// Partitions space by creating an accelerated zone around a target object where AABB queries are faster to execute. | |
/// Objects outside the accelerated zone are throttled by feeding them aggregate delta times to drastically reduce the workload of updating them. | |
/// - Returns accurate results for queries outside the zone as well, but at a cost of brute force query + overhead. | |
/// - Throttling is not load-balanced over multiple ticks, i.e. every X tick is more expensive to execute. | |
/// </summary> | |
public class AcceleratedSpacePartition | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Naive, suboptimal | |
IEnumerable<string> GetLongestPalindromes(string s) | |
{ | |
List<string> palindromes = new List<string>(); | |
var len = s.Length; | |
for (int i = 0; i < len; i++) | |
{ | |
for (int j = len - 1; j > i; j--) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.ComponentModel; | |
using System.Diagnostics; | |
using System.Linq; | |
using System.Runtime.InteropServices; | |
using System.Runtime.Serialization; | |
/// <summary> | |
/// Only for 32 bit processes. The methods of this static class can find the special symbol ThreadStack0, | |
/// and follow pointer chains to return the end result in the specified type T. |