Tag Archives: search

Sort and search arrays in C#

The Array class provides several useful methods for working with arrays. Two of them let you sort and search arrays. The following code shows how the program uses the Array class’s Sort method to sort an array of random data. … Continue reading

Posted in algorithms, arrays | Tagged , , , , , , , , , , , | 1 Comment

Let the user pick database search criteria in C#

The top part of this program holds three columns of controls. The left column contains combo boxes holding the names of the fields in a database table. The middle column holds operators such as =, <, and >=. The right … Continue reading

Posted in database, user interface | Tagged , , , , , , , , , , , | 1 Comment

Find files that match multiple patterns in C#

The System.IO.Directory.GetFiles method lets you easily search for files in a directory that match a pattern. Unfortunately it can only search for files that match a single pattern. For example, if you want to find files that match the patterns … Continue reading

Posted in .NET, files | Tagged , , , , , , , , , , , , , , | Leave a comment

Use branch and bound with an initial heuristic to solve the partition problem in C#

The post Use exhaustive search to solve the partition problem in C# explains the partition problem and how you can use an exhaustive search to find solutions for it. The post Use branch and bound to solve the partition problem … Continue reading

Posted in algorithms, mathematics | Tagged , , , , , , , , , , , , , , , , , , , , | 1 Comment

Use branch and bound to solve the partition problem in C#

The post Use exhaustive search to solve the partition problem in C# explains the partition problem and how you can use an exhaustive search to find solutions for it. Unfortunately the number of possible solutions is enormous. If you are … Continue reading

Posted in algorithms, mathematics | Tagged , , , , , , , , , , , , , , , , , , , , | 3 Comments

Use exhaustive search to solve the partition problem in C#

In the partition problem, the goal is to divide a set of numbers into two subsets that have the same total. My favorite story for the partition problem is the “booty division problem.” Suppose you and a friend find a … Continue reading

Posted in algorithms, mathematics | Tagged , , , , , , , , , , , , , , , , , , , , | 4 Comments

Find, open, and replace text in files in C#

The example Find files and replace text in them in C# shows how you can find and replace text in files. This example modifies that one to let you open the files you find by double clicking on them in … Continue reading

Posted in directories, files, tools | Tagged , , , , , , , , , , , , , | Leave a comment

Find files and replace text in them in C#

This program lets you recursively find files in a directory hierarchy that match one or more patterns. You can then replace text in those files with new text. Both the Find and Find & Replace buttons call the SearchForFiles method. … Continue reading

Posted in directories, files, tools | Tagged , , , , , , , , , , , | 1 Comment