I wrote a C # Sort class.

Source: Internet
Author: User

//-----------------------------------------------------------------------------
//
// Algorithm: Sorting class
//
// Copyright (C) Snowdust
// Personal blog http://blog.csdn.net/snowdust & http://snowdust.cnblogs.com
// MSN & Email snowdust77@sina.com
//
// This source code can be used for all types of software (including commercial software) for free)
// Allows further modification and development of this Code
// But the copyright information must be kept completely
//
// The call method is as follows:
//
// 1. GetPermutation (T [], startIndex, endIndex)
// Returns the sequence from startIndex to endIndex.
//
// 2. GetPermutation (T [])
// Returns the full arrangement of all elements in the array.
//
// Version history:
// V0.1 2010-01-20 Abstract: initial creation
//
//-----------------------------------------------------------------------------

Using System;
Using System. Collections. Generic;

Namespace Arithmetic
{
Public class Permutation <T>
{
/// <Summary>
/// Exchange two variables
/// </Summary>
/// <Param name = "a"> variable 1 </param>
/// <Param name = "B"> variable 2 </param>
Public static void Swap (ref T a, ref T B)
{
T temp =;
A = B;
B = temp;
}

/// <Summary>
/// Recursive algorithm for ranking (Private member)
/// </Summary>
/// <Param name = "list"> returned list </param>
/// <Param name = "t"> original array </param>
/// <Param name = "startIndex"> Start number </param>
/// <Param name = "endIndex

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.