Posts

Showing posts with the label search strings radix tree

Search strings from a list using Radix Tree

A logic to build a Radix tree (not completely though..) to search a string from a list of strings. Ideally the radix tree should be built something like this , but the logic below constructs a node for every character in the string. using System ; using System.Collections.Generic ; using System.Linq ; using System.Text ; using System.Threading.Tasks ; namespace RadixTree { class Program { public class Node { public char _Character; public List<Node> _Children = new List<Node>(); } private static List<Node> traversedNodes = new List<Node>(); private static bool stopTraversing = false ; private static string wordString = "" ; private static string mainString = "" ; private static string [] searchStrings = new string [] { "Chicago" , ...