bubble sort c#
C#
using System;
namespace BubbleSort {
class Sorting {
static void Main(string[] args) {
int[] mixdata = { 56, 23, 2, 86, 45, 102 };
int temp;
for (int j = 0; j <= mixdata.Length - 2; j++) {
for (int i = 0; i <= mixdata.Length - 2; i++) {
if (mixdata[i] > mixdata[i + 1]) {
temp= mixdata[i + 1];
mixdata[i + 1] = mixdata[i];
mixdata[i] = temp;
}
}
}
Console.WriteLine("Bubble sort data:");
foreach (int p in mixdata)
Console.Write(p + " ");
Console.Read();
}
}
}using System;
namespace BubbleSort_3Languages
{
class Program
{
static void Main(string[] args)
{
int[] array = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 };
bubblesort(array);
foreach (int element in array)
{
Console.WriteLine(element);
}
}
static void bubblesort(int[] array)
{
int len = array.Length;
for (int i = 0; i < len; i++)
{
for (int j = 0; j < len; j++)
{
int a = array[j];
if (a != array[len - 1])
{
int b = array[j + 1];
if (a > b)
{
array[j] = b;
array[j + 1] = a;
}
}
}
}
}
}
}
Also in C#:
- Title
- c# generic abstract method
- Category
- C#
- Title
- debug.log unity
- Category
- C#
- Title
- c# console delay
- Category
- C#
- Title
- C# type cast float to string
- Category
- C#
- Title
- how to name GameObject in c#
- Category
- C#
- Title
- how to add a list to observablecollection in c#
- Category
- C#
- Title
- c# how to run external program with args
- Category
- C#
- Title
- firefoxoptions setpreference to trust certificates
- Category
- C#
- Title
- unity instantiate an object
- Category
- C#
- Title
- Instantiate c#
- Category
- C#
- Title
- create object in c#
- Category
- C#
- Title
- unity delete all children
- Category
- C#
- Title
- c# delegate return value invoke
- Category
- C#
- Title
- how to get component in unity c#
- Category
- C#
- Title
- unity fps counter
- Category
- C#
- Title
- how to store some variables on the device in unity
- Category
- C#
- Title
- built in methods to order a list c#
- Category
- C#
- Title
- unity ui change sprite
- Category
- C#
- Title
- how to turn a string in a char list c#
- Category
- C#
- Title
- check version of asp.net core
- Category
- C#
- Title
- c# inline if
- Category
- C#
- Title
- decimals not stored in azure tables
- Category
- C#
- Title
- zoom gedit
- Category
- C#
- Title
- get setter c# model
- Category
- C#
- Title
- compose graphql query string in c#
- Category
- C#
- Title
- Unity how to put IEnumerator in update and loop once with yeild return new waitforseconds
- Category
- C#
- Title
- No context type was found in the assembly
- Category
- C#
- Title
- regex in c#
- Category
- C#
- Title
- mvc c# w3schools
- Category
- C#
- Title
- generate range c#
- Category
- C#
- Title
- unity 2d detect click on sprite
- Category
- C#
- Title
- c# map
- Category
- C#
- Title
- c# linq to get most recent item from IList
- Category
- C#
- Title
- c# datetime dd/mm/yyy hh:mm:ss
- Category
- C#
- Title
- c# error "The name 'ViewBag' does not exist in the current context"
- Category
- C#
- Title
- unity scene name get
- Category
- C#
- Title
- unity pro version free download
- Category
- C#
- Title
- unity access child
- Category
- C#
- Title
- c# class to byte array
- Category
- C#
- Title
- interpolate rotation unity3d
- Category
- C#
- Title
- c# listview
- Category
- C#
- Title
- c# get motherboard id
- Category
- C#
- Title
- c# string code ascii
- Category
- C#
- Title
- c# read all text from a file
- Category
- C#
- Title
- fly cam extended script unity 3d
- Category
- C#
- Title
- Check object is in layermask unity
- Category
- C#
- Title
- IEnumerator
- Category
- C#
- Title
- how to do cmd command c#
- Category
- C#
- Title
- c# null conditional operator if statement
- Category
- C#
- Title
- csharp check if env is development
- Category
- C#
- Title
- using in c#
- Category
- C#
- Title
- date time heutiges datum
- Category
- C#
- Title
- computer
- Category
- C#
- Title
- c# variable
- Category
- C#
- Title
- grab reference from method parameter c#
- Category
- C#
- Title
- c# new list object
- Category
- C#
- Title
- c# creating a data recovery software
- Category
- C#
- Title
- how to access first child of parent unity
- Category
- C#
- Title
- c# bitmap to array byte
- Category
- C#
- Title
- c# empty IEnumerable
- Category
- C#
- Title
- modal dismiss
- Category
- C#
- Title
- No IUserTwoFactorTokenProvider<TUser> named 'Default' is registered.'
- Category
- C#
- Title
- csharp attributes as generics constraints
- Category
- C#
- Title
- exception handling c#
- Category
- C#
- Title
- c# param exception
- Category
- C#
- Title
- How to search for a string from readline in c#
- Category
- C#
- Title
- c# double value with 2 decimal places
- Category
- C#
- Title
- how to add a gameobject
- Category
- C#
- Title
- c# clear list items
- Category
- C#
- Title
- c# string to character array
- Category
- C#
- Title
- c# random string
- Category
- C#
- Title
- membership get user id
- Category
- C#
- Title
- vb.net tostring numeric format string
- Category
- C#
- Title
- unity mouse click position
- Category
- C#
- Title
- select a whole row out of a 2d array C#
- Category
- C#
- Title
- unity try get component
- Category
- C#
- Title
- c# read excel file
- Category
- C#
- Title
- C# resize window without title bar
- Category
- C#
- Title
- c# postfix increment operator overload
- Category
- C#
- Title
- .net core identity get user id
- Category
- C#
- Title
- c# windows application get current path
- Category
- C#
- Title
- c# expandoobject indexer
- Category
- C#
- Title
- replace double backslash with single backslash c#
- Category
- C#
- Title
- unity custom update
- Category
- C#
- Title
- how to stop a form c#
- Category
- C#
- Title
- how to reference function in unity
- Category
- C#
- Title
- set decimal point c#
- Category
- C#
- Title
- unity create primitive
- Category
- C#
- Title
- idbset sqlquery
- Category
- C#
- Title
- unity docs player input
- Category
- C#
- Title
- get enum value c#
- Category
- C#
- Title
- c# getter setter
- Category
- C#
- Title
- how to insert <input> datatype <td> in asp.net core table
- Category
- C#
- Title
- c# exit program
- Category
- C#
- Title
- unity how to change max fps
- Category
- C#
- Title
- unity set material
- Category
- C#
- Title
- c# split a string and return list
- Category
- C#
- Title
- c# get date without time
- Category
- C#
- Title
- c# empty char
- Category
- C#
- Title
- how to convert from hexadecimal to binary in c#
- Category
- C#