Posts

Showing posts from March, 2012

How to hide generated javascript file in visual studio code

In this post I am going to show you a cool trick in visual studio code. Let's suppose you are writing typescript code in visual studio code and you want to hide generated javascript code.

Create .vscode folder in your folder and then create settings.json file and paste following code

{ "files.exclude": { "node_modules":true, "**/.git": true, "**/.DS_Store": true, "**/*.js.map": true, "**/*.js": {"when": "$(basename).ts"}     } }

How to implement bubble sort in c#

Image
In this post,I am going to show you how to implement bubble sorting in c#.
What is Bubble Sort
Bubble sort, is a simple sorting algorithm that works by repeatedly stepping through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order.
Implementation


using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace SortingDemo { publicclass BubbleSort { publicvoid BubbleSort() { //Initialize array dataint[] data = { 5, 3, 6, 1, 8, 7, 2, 4 }; for (int outerIndex = 0; outerIndex < data.Length; outerIndex++) { for (int innerIndex = 0; innerIndex < data.Length-1; innerIndex++) { if (data[innerIndex] > data[innerIndex+1]) { //swap data. Swap(data, innerIndex); } } } } privatestaticvoid Swap(int[] dat…