longest (195)


Tree(directed acyclic graph) implementation

I require a tree/directed acyclic graph implementation something like this: public class TreeNode<K, V>{private K key;// 'key' for this node, always present private V value;// 'value' f…


What is the optimum limit for URL length? 100, 200+

I have an ASP.Net 3.5 platform and windows 2003 server with all the updates. There is a limit with.Net that it cannot handle more than 260 characters. Moreover if you look it up on web, you will fi…


algorithm - Palindrome detection efficiency

I got curious by Jon Limjap's interview mishap and started to look for efficient ways to do palindrome detection. I checked the palindrome golf answers and it seems to me that in the answers are two…


How can I find the Largest Common Substring between two strings in PHP?

Is there a fast algorithm for finding the Largest Common Substring in two strings or is it an NPComplete problem? In PHP I can find a needle in a haystack:<?php if(strstr("there is a needle in a h…


comboBox width depending on longest item

i've got a ComboBox that i generate dynamically and fill with some items. i would like to set this control's width to the width of the longest item. how do i count the display width of some text? edi…


finding long repeated substrings in a massive string

I naively imagined that I could build a suffix trie where I keep a visit-count for each node, and then the deepest nodes with counts greater than one are the result set I'm looking for. I have a real…



How to portably convert a string into an uncommon integer type?

Some background: If I wanted to use for, for instance, scanf() to convert a string into a standard integer type, like uint16_t, I’d use SCNu16 from<inttypes.h>, like this:#include<stdio.h>#includ…


The Most Efficient Algorithm to Find First Prefix-Match From a Sorted String Array?

Input: 1) A huge sorted array of string SA; 2) A prefix string P; Output: The index of the first string matching the input prefix if any. If there is no such match, then output will be-1. Example: S…


Algorithm to find two points furthest away from each other

Im looking for an algorithm to be used in a racing game Im making. The map/level/track is randomly generated so I need to find two locations, start and goal, that makes use of the most of the map. T…


What's the probability that X*consecutive* bits in an array of N bits is set to 1?

I'm trying to code a simple, sufficiently accurate filter for validating a piece of hardware in an RTL simulation. We're simulating the randomness inherent in a chip's flip-flops, by randomly initia…




find python java the string common length substring subsequence array