Improved Combinations with the BigInteger Data Type: Listing 1.

Structure of the Combinatorics program.

using System;
using System.Numerics;
namespace Combinatorics
{
  class CombinatoricsProgram
  {
    static void Main(string[] args)
    {
      Console.WriteLine("\nBegin combinations with C# BigInteger demo\n");
      // calling code here
      Console.WriteLine("\nEnd demo\n");
      Console.ReadLine();
    }
  }

  public class Combination
  {
    private int n;
    private int k;
    private int[] data;

    public Combination(int n, int k) { ... }
    public override string ToString() { ... }
    public Combination Successor() { ... }
    public static BigInteger Choose(int n, int k) { ... }
    public Combination Element(BigInteger m) { ... }
    private static int LargestV(int a, int b, BigInteger x) { ... }
    public string[] ApplyTo(string[] a) { ... }
  } // class Combination
} // ns

About the Author

Dr. James McCaffrey works for Microsoft Research in Redmond, Wash. He has worked on several Microsoft products including Azure and Bing. James can be reached at [email protected].com.

comments powered by Disqus

Featured

  • Clustering Non-Numeric Data Using C#

    Clustering non-numeric -- or categorial -- data is surprisingly difficult, but it's explained here by resident data scientist Dr. James McCaffrey of Microsoft Research, who provides all the code you need for a complete system using an algorithm based on a metric called category utility (CU), a measure how much information you gain by clustering.

  • So What's Up with Microsoft's (and Everyone Else's) Love of Rust?

    Microsoft already stewards several popular programming languages -- C#, TypeScript, F# -- so what's up with its love of Rust, along with the rest of the world?

  • C# Steps Up Programming Language Popularity Ladder

    Microsoft's C# programming language climbed a year-over-year notch on the TIOBE Index, which measures popularity among developers.

  • VS Code Java Tool Updates Debugging, Refactoring

    The monthly update to the tooling that boosts Java development in the open source, cross-platform Visual Studio Code editor highlights debugging, refactoring and more.

  • Microsoft Plugs Away at Blazor for Mobile in Preview 3

    Microsoft is furthering its work to target mobile app development with Blazor, the ASP.NET Core offering that originally was developed to allow for C#-based web development instead of JavaScript through the use of WebAssembly for the client side.

.NET Insight

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.

Upcoming Events