• ## Implementation of BubbleSort in C + +

Time：2021-1-24

This example for you to share the C + + bubble sort specific code, for your reference, the specific content is as follows 1、 Thinking: Bubble sort algorithm principle: 1. Compare the adjacent elements. If the first number is larger than the second number, exchange them. 2. Do the same work for each pair of […]

• ## Ruby based insertion and bubble sorting algorithms

Time：2020-3-23

1. Insert sort Copy codeThe code is as follows: seq = [3,4,9,0,2,5,9,7,1] 1.upto(seq.length-1) do |i|  if seq[i] < seq[i-1]    tmp = seq[i]    j = i-1    while(j>=0 && tmp<seq[j]) do      seq[j+1] = seq[j]      j=j-1    end    seq[j+1]=tmp  endend seq.each {|num| puts num} 2. Bubble sorting Copy codeThe code is as follows: seq = [3,4,9,0,2,5,9,7,1,100,99,24,64,18,88,66] 0.upto(seq.length-1) do |i|  […]

• ## The implementation of bubbling sort method in C language (ascending sort method)

Time：2020-3-22

Task Code: Sorting of numbers: #include <stdio.h> #define SIZE 10 int main() { Int a [size] = {12, 43, 9, 13, 67, 98101, 89, 3, 35}; // disordered series of ten numbers int i,j,t; Printf (“this program uses bubble sorting to arrange the unordered sequence! \n “”; //Bubble sorting For (I = 0; I < […]

• ## An example of advanced play method for. Net set sorting

Time：2019-12-29

Preface This article mainly introduces another advanced play method of. Net set sorting. The example code is introduced in detail in this article. You can refer to and learn from it if you need. Let’s have a look at the detailed introduction Background: Students have names and student numbers, Class name and serial number The […]

• ## Example code of bubble sort, merge sort and fast sort in Scala

Time：2019-10-19

1. Bubble sorting def sort(list: List[Int]): List[Int] = list match { case List() => List() case head :: tail => compute(head, sort(tail)) } def compute(data: Int, dataSet: List[Int]): List[Int] = dataSet match { case List() => List(data) case head :: tail => if (data <= head) data :: dataSet else head :: compute(data, tail) } […]

• ## Python algorithm and bubble sorting of data structure

Time：2019-7-25

Introduction to Bubble Sorting Bubble Sort is a simple sorting algorithm. It iterates through the columns to be sorted, comparing two elements at a time, and swapping them if their order is wrong. The work of traversing a sequence is repeated until no exchange is needed, that is to say, the sequence has been sorted. […]

• ## Graphical Notes of Algorithms Recursion

Time：2019-5-4

Recursion is an interesting concept. As mentioned earlier, recursion can greatly improve the readability of algorithms, and it is usually better than using circular structures to write accurate algorithms. The image of this book is recursive, not too deep, so I did a little “add fuel and vinegar”. recursion concept Recursion is actually self-invoking. Recursive […]

• ## Bubble Sorting Algorithms and Simple Implementation of Ruby Edition

Time：2019-4-13

Algorithmic principles: Compare adjacent elements. If the first one is bigger than the second one, exchange the two.Do the same work for each pair of adjacent elements, from the first pair at the beginning to the last pair at the end. At this point, the last element should be the largest number.Repeat the above steps […]