Posts

Showing posts with the label bubble

Top 5 Programming language need to learn in 2020

Image
Top 5 Programming Languages need to learn in 2020 If you're new to software development. The first question that comes to mind is where to start? This is probably true! There are hundreds of choices. How are you going to discover that this is the language I want to learn? What will be the most appropriate for you, your interests and your professional goals? One of the easiest ways to choose the best programming language to learn in 2020 is to listen to what the market says. Where the technology trend is heading ... What to learn in 2020 1. JavaScript Without Javascript, you cannot think of interactive web pages. That is the main reason JavaScript is so much popular among software developers. Today, it seems impossible to be a software developer without the use of JavaScript. First from the list is JavaScript, it seems impossible to imagine software development without JavaScript. In Stack Overflow 2018 for developers, JavaScript is the most widely used by developers in t

Bubble sort in Python Language

Image
Bubble sort is the simplest Sorting algorithm available. It works by repeatedly swapping the adjacent or neighbor element if they are in the wrong order. Working Actually in the first-pass bubble sort sets the largest element to its position, in the second pass algorithm sets the second largest element this continues till the list or array is not finally sorted. Here is the example image. To work with the algorithm you first have to understand what is swapping and how it is done. What is Swapping ?? Swapping is a technique to interchange the content of the two variables, using another variable called a temporary variable. In python programming language swapping works in two ways, both of them are shown below. For the program in Python arr = [64, 34, 25, 12, 22, 11, 90] n = len(arr) for i in range(n): # Last i elements are already in place for j in range(0, n-i-1): # traverse the array from 0 to n-i-1 # Swap if the element found is greater # than the next element if

Bubble Sort in C language

Image
Bubble sort is the simplest Sorting algorithm available. It works by repeatedly swapping the adjacent or neighbor element if they are in the wrong order. Working Actually in first pass bubble sort sets the largest element to its position, in the second pass algorithm sets the second largest element this continues till the list or array is not finally sorted. Here is the example image. To work with the algorithm you first have to understand what is swapping and how it is done. What is Swapping ?? Swapping is the technique to interchange the content of the two variables, using another variable called temporary variable. For the program in C #include <stdio.h> void bubbleSort(int s[],int size){ int c,swap,d; for (c = 0 ; c < size - 1; c++) { for (d = 0 ; d < size - c - 1; d++) { if (s[d] > s[d+1]) /* For decreasing order use < */ { swap = s[d]; s[d] = s[d+1]; s[d+1] = swap