algorithm

Brute force characters into a textbox in c#

I want to make a program that "test passwords" to see how long they would take to break with a basic brute force attack. So what I did was make 2 text boxes. (textbox1 and textbox2) and wrote the program so if the text boxes had the input, a "correct password" label would appear, but i want to write the program so that textbox2 will run...

Discover periodic patterns in a large data-set

I have a large sequence of tuples on disk in the form (t1, k1) (t2, k2) ... (tn, kn) ti is a monotonically increasing timestamp and ki is a key (assume a fixed length string if needed). Neither ti nor ki are guaranteed to be unique. However, the number of unique tis and kis is huge (millions). n itself is very large (100 Million+) and ...

BFS traversal of directed graph from a given node

Hi, My understanding of basic BFS traversal for a graph is: BFS { Start from any node . Add it to que. Add it to visited array While(que is not empty) { remove head from queue. Print node; add all unvisited direct subchilds to que; mark them as visited } } However, if we have to traverse a DIRECTED graph from a...

Time complexity of Sieve of Eratosthenes algorithm

From Wikipedia: The complexity of the algorithm is O(n(logn)(loglogn)) bit operations. How do you arrive at that? That the complexity includes the loglogn term tells me that there is a sqrt(n) somewhere. Suppose I am running the sieve on the first 100 numbers (n = 100), assuming that marking the numbers as c...

How to represent a Towers of Hanoi problem using a graph?

I am not able to figure out how the graphs shown here are constructed? For example, what does this graph represent? "Nodes are distribution of discs", but I will only have one disc of size a. So, what does node aa represent? I know the answer would be simple, but I cannot figure it out at the moment. ...

Finding minimum cut-sets between bounded subgraphs

If a game map is partitioned into subgraphs, how to minimize edges between subgraphs? I have a problem, Im trying to make A* searches through a grid based game like pacman or sokoban, but i need to find "enclosures". What do i mean by enclosures? subgraphs with as few cut edges as possible given a maximum size and minimum size for numbe...

What algorithm .Net use for searching a pattern in a string?

I'm studying string searching algorithms now and wondering what algorithm is used for .NET String.Contains function for example. Reflector shows that this function is used but I have no idea what its name means. private static extern int InternalFindNLSStringEx(IntPtr handle, string localeName, int flags, string source, int sourceCount,...

Zoom image to pixel level

For an art project, one of the things I'll be doing is zooming in on an image to a particular pixel. I've been rubbing my chin and would love some advice on how to proceed. Here are the input parameters: Screen: sw - screen width sh - screen height Image: iw - image width ih - image height Pixel: px - x position of pixel in image py ...

User submitted content filtering

Hey all, Does anyone have any ideas on what could be used as a way to filter untrustworthy user submitted content? Take Yelp for instance, they would need to prevent competitors writing business reviews on their competitors. They would need to prevent business owners favourably reviewing their own business, or forcing friends/family to...

Fastest algorithm for primality test

I need to test primality on intervals between numbers which are really big (in the range of long long), so i need some fast algorithm for checking if a number is prime or not. Please suggest your ideas. ...

An algorithm to find bounding box of closed bezier curves?

I'm looking for an algorithm to find bounding box (max/min points) of a closed quadratic bezier curve in Cartesian axis: input: C (a closed bezier curve) output: A B C D points Note: above image shows a smooth curve. it could be not smooth. (have corners) ...

Open Source Graph Layout Library

I'm looking for an open source (GPL, LGPL etc) graph layout library for .net framework, preferably fully managed code. Im not worried about the visualisation aspect of things. I can find lots of them for Java, but none for .net... Thanks! ...

Extend base type and automatically update audit information on Entity

I have an entity model that has audit information on every table (50+ tables) CreateDate CreateUser UpdateDate UpdateUser Currently we are programatically updating audit information. Ex: if(changed){ entity.UpdatedOn = DateTime.Now; entity.UpdatedBy = Environment.UserName; context.SaveChanges(); ...

Algorithm to detect no movable pieces in Stratego.

I am creating a Stratego Game and am having trouble creating an algorithm that can detect when there are no more possible moves because all your pieces are gone or the remaining pieces are unmovable or trapped by forbidden squares, unmovable pieces, or other trapped pieces. For simplicity you can think of the board as an array of Square...

8-direction path finding algorithm

I'm having trouble finding the right pathfinding algorithm for some AI I'm working on. I have players on a pitch, moving around freely (not stuck to a grid), but they are confined to moving in 8 directions (N NE E etc.) I was working on using A*, and a graph for this. But I realised, every node on the graph is equally far apart, and al...

How do I modify an attribute across all rows in a table?

Hi folks, My apologies for asking such a novice question but, I need help building a script using either PHP or directly in MySQL that can do the following: Take the values of a column in a table (text) Change them into capitalized words (from "this is a title" to "This Is A Title") Replace the old values (uncapitalized) with the new ...

Finding missing numbers in an array

Given an array of size n, which contains numbers in the range 1 to n, and in which each number is present at least once, but some numbers may be missing, how can I find the missing numbers? ...

number of comparisons of binary search

What is the total number of comparisons necessary to locate all the n sorted distinct integers in an array using binary search? I think the number is n log2 n (2 is the base), but I am not sure. What do you think? ...

what is the name of snake-like image traversing algorithm?

The algorithm name is after some mathematician. You can traverse image line by line of course, but you can traverse image using recursive generated path, which the basic blocks looks like: U This one is for traversal 2x2 pixels image. If you have bigger image, you "multiply" this block (rotated or not) for each segment. The result is ...

Distribution of items from "x" sets of plants in "y" baskets equally.

I need ideas about algorithm for distribution of plants in groups. I have, say 5, sets of plants and each set depicts a certain property e.g., setA= {set of all plants that are green in color} setB = {set of all plants red in color} setC={ all the plants that are roots also} setD= {fruits} setE= [flowers} A plant can be a memb...