The repository is a collection of open-source implementation of a variety of algorithms implemented in Go and licensed under MIT License.
Read our Contribution Guidelines before you contribute.
Advanced: Advanced Function performing the Advanced Aho-Corasick algorithm. Finds and prints occurrences of each pattern.AhoCorasick: AhoCorasick Function performing the Basic Aho-Corasick algorithm. Finds and prints occurrences of each pattern.ArrayUnion: ArrayUnion Concats two arrays of int's into one.BoolArrayCapUp: BoolArrayCapUp Dynamically increases an array size of bool's by 1.BuildAc: Functions that builds Aho Corasick automaton.BuildExtendedAc: BuildExtendedAc Functions that builds extended Aho Corasick automaton.ComputeAlphabet: ComputeAlphabet Function that returns string of all the possible characters in given patterns.ConstructTrie: ConstructTrie Function that constructs Trie as an automaton for a set of reversed & trimmed strings.Contains: Contains Returns 'true' if array of int's 's' contains int 'e', 'false' otherwise.CreateNewState: CreateNewState Automaton function for creating a new state 'state'.CreateTransition: CreateTransition Creates a transition for function σ(state,letter) = end.GetParent: GetParent Function that finds the first previous state of a state and returns it. Used for trie where there is only one parent.GetTransition: GetTransition Returns ending state for transition σ(fromState,overChar), '-1' if there is none.GetWord: GetWord Function that returns word found in text 't' at position range 'begin' to 'end'.IntArrayCapUp: IntArrayCapUp Dynamically increases an array size of int's by 1.StateExists: StateExists Checks if state 'state' exists. Returns 'true' if it does, 'false' otherwise.Result: No description provided.IsArmstrong: No description provided.Abs: Abs returns absolute value using binary operation Principle of operation: 1) Get the mask by right shift by the base 2) Base is the size of an integer variable in bits, for example, for int32 it will be 32, for int64 it will be 64 3) For negative numbers, above step sets mask as 1 1 1 1 1 1 1 1 and 0 0 0 0 0 0 0 0 for positive numbers. 4) Add the mask to the given number. 5) XOR of mask + n and mask gives the absolute value.BitCounter: BitCounter - The function returns the number of set bits for an unsigned integer numberFastInverseSqrt: FastInverseSqrt assumes that argument is always positive, and it does not deal with negative numbers. The "magic" number 0x5f3759df is hex for 1597463007 in decimals. The math.Float32bits is alias to *(*uint32)(unsafe.Pointer(&f)) and math.Float32frombits is to *(*float32)(unsafe.Pointer(&b)).IsPowerOfTwo: IsPowerOfTwo This function uses the fact that powers of 2 are represented like 10...0 in binary, and numbers one less than the power of 2 are represented like 11...1. Therefore, using the and function: 10...0 & 01...1 00...0 -> 0 This is also true for 0, which is not a power of 2, for which we have to add and extra condition.IsPowerOfTwoLeftShift: IsPowerOfTwoLeftShift This function takes advantage of the fact that left shifting a number by 1 is equivalent to multiplying by 2. For example, binary 00000001 when shifted by 3 becomes 00001000, which in decimal system is 8 or = 2 * 2 * 2LogBase2: LogBase2 Finding the exponent of n = 2**x using bitwise operations (logarithm in base 2 of n) See moreMeanUsingAndXor: MeanUsingAndXor This function finds arithmetic mean using "AND" and "XOR" operationsMeanUsingRightShift: MeanUsingRightShift This function finds arithmetic mean using right shiftReverseBits: ReverseBits This function initialized the result by 0 (all bits 0) and process the given number starting from its least significant bit. If the current bit is 1, set the corresponding most significant bit in the result and finally move on to the next bit in the input number. Repeat this till all its bits are processed.SequenceGrayCode: SequenceGrayCode The function generates an "Gray code" sequence of length nSqrt: No description provided.XorSearchMissingNumber: XorSearchMissingNumber This function finds a missing number in a sequenceNewLRU: NewLRU represent initiate lru cache with capacityNewLFU: NewLFU represent initiate lfu cache with capacityGet: Get the value by key from LFU cachePut: Put the key and value in LFU cacheDecrypt: Decrypt decrypts by left shift of "key" each character of "input"Encrypt: Encrypt encrypts by right shift of "key" each character of "input"FuzzCaesar: No description provided.CatalanNumber: CatalanNumber This function returns the nth Catalan numberCRC8: CRC8 calculates CRC8 checksum of the given data.Luhn: Luhn validates the provided data using the Luhn algorithm.CRCModel: No description provided.BipartiteCheck: basically tries to color the graph in two colors if each edge connects 2 differently colored nodes the graph can be considered bipartiteGraph: No description provided.Start: Start ...Combinations: No description provided.HuffDecode: HuffDecode recursively decodes the binary code in, by traversing the Huffman compression tree pointed by root. current stores the current node of the traversing algorithm. out stores the current decoded string.HuffEncode: HuffEncode encodes the string in by applying the mapping defined by codes.HuffEncoding: HuffEncoding recursively traverses the Huffman tree pointed by node to obtain the map codes, that associates a rune with a slice of booleans. Each code is prefixed by prefix and left and right children are labelled with the booleans false and true, respectively.HuffTree: HuffTree returns the root Node of the Huffman tree by compressing listfreq. The compression produces the most optimal code lengths, provided listfreq is ordered, i.e.: listfreq[i] <= listfreq[j], whenever i < j.Node: No description provided.
SymbolFreq: No description provided.
SymbolCountOrd: SymbolCountOrd computes sorted symbol-frequency list of input messageBase64Decode: Base64Decode decodes the received input base64 string into a byte slice. The implementation follows the RFC4648 standard, which is documented at https://datatracker.ietf.org/doc/html/rfc4648#section-4Base64Encode: Base64Encode encodes the received input bytes slice into a base64 string. The implementation follows the RFC4648 standard, which is documented at https://datatracker.ietf.org/doc/html/rfc4648#section-4BinaryToDecimal: BinaryToDecimal() function that will take Binary number as string, and return it's Decimal equivalent as integer.DecimalToBinary: DecimalToBinary() function that will take Decimal number as int, and return it's Binary equivalent as string.FuzzBase64Encode: No description provided.HEXToRGB: HEXToRGB splits an RGB input (e.g. a color in hex format; 0x<color-code>) into the individual components: red, green and blueIntToRoman: IntToRoman converts an integer value to a roman numeral string. An error is returned if the integer is not between 1 and 3999.RGBToHEX: RGBToHEX does exactly the opposite of HEXToRGB: it combines the three components red, green and blue to an RGB value, which can be converted to e.g. HexReverse: Reverse() function that will take string, and returns the reverse of that string.RomanToInt: RomanToInt converts a roman numeral string to an integer. Roman numerals for numbers outside the range 1 to 3,999 will return an error. Nil or empty string return 0 with no error thrown.New: New returns a new DoublyEndedQueue.DoublyEndedQueue: No description provided.QueryStructure: No description provided.
TestCaseData: No description provided.
GenerateMutualKey: GenerateMutualKey : generates a mutual key that can be used by only alice and bob mutualKey = (shareKey^prvKey)%primeNumberGenerateShareKey: GenerateShareKey : generates a key using client private key , generator and primeNumber this key can be made public shareKey = (g^key)%primeNumberAbbreviation: Returns true if it is possible to make a equals b (if b is an abbreviation

阿里Qoder团队推出的桌面端AI智能体
QoderWork 是阿里推出的本地优先桌面 AI 智能体,适配 macOS14+/Windows10+,以自然语言交互实现文件管理、数据分析、AI 视觉生成、浏览器自动化等办公任务,自主拆解执行复杂工作流,数据本地运行零上传,技能市场可无限扩展,是高效的 Agentic 生产力办公助手。


全球首个AI音乐社区
音述AI是全球首个AI音乐社区,致力让每个人都能用音乐表达自我。音述AI提供零门槛AI创作工具,独创GETI法则帮助用户精准定义音乐风格,AI润色功能支持自动优化作品质感。音述AI支持交流讨论、二次创作与价值变现。针对中文用户的语言习惯与文化背景进行专门优化,支持国风融合、C-pop等本土音乐标签,让技术更好地承载人文表达。


一站式搞定所有学习需求
不再被海量信息淹没,开始真正理解知识。Lynote 可摘要 YouTube 视频、PDF、文章等内容。即时创建笔记,检测 AI 内容并下载资料,将您的学习效率提升 10 倍。


为AI短剧协作而生
专为AI短剧协作而生的AniShort正式发布,深度重构AI短剧全流程生产模式,整合创意策划、制作执行、实时协作、在线审片、资产复用等全链路功能,独创无限画布、双轨并行工业化工作流与Ani智能体助手,集成多款主流AI大模型,破解素材零散、版本混乱、沟通低效等行业痛点,助力3人团队效率提升800%,打造标准化、可追溯的AI短剧量产体系,是AI短剧团队协同创作、提升制作效率的核心工具。


能听懂你表达的视频模型
Seedance two是基于seedance2.0的中国大模型,支持图像、视频、音频、文本四种模态输入,表达方式更丰富,生成也更可控。


国内直接访问,限时3折
输入简单文字,生成想要的图片,纳米香蕉中文站基于 Google 模型的 AI 图片生成网站,支持文字生图、图生图。官网价格限时3折活动


职场AI,就用扣子
AI办公助手,复杂任务高效处理。办公效率低?扣子空间AI助手支持播客生成、PPT制作、网页开发及报告写作,覆盖科研、商业、舆情等领域的专家Agent 7x24小时响应,生活工作无缝切换,提升50%效率!


多风格AI绘画神器
堆友平台由阿里巴巴设计团队创建,作为一款AI驱动的设计工具,专为设计师提供一站式增长服务。功能覆盖海量3D素材、AI绘画、实时渲染以及专业抠图,显著提升设计品质和效率。平台不仅提供工具,还是一个促进创意交流和个人发展的空间,界面友好,适合所有级别的设计师和创意工作者。


零代码AI应用开发平台
零代码AI应用开发平台,用户只需一句话简单描述需求,AI能自动生成小程序、APP或H5网页应用,无需编写代码。


免费创建高清无水印Sora视频
Vora是一个免费创建高清无水印Sora视频的AI工具
最新AI工具、AI资讯
独家AI资源、AI项目落地

微信扫一扫关注公众号