### Author

##### Implement Merge Sort using C++

In this article, you will learn about a sorting algorithm that uses divide and conquer strategy to sort an array. Merge sort first divides an array into equal parts and then combines them after sorting. A C++ Implement of Merge Sort To understand how merge sort works, let’s consider an array called arr[] having a... » read more

##### Implement Heap Sort using C++

A heap is a tree-based data structure in which the tree is almost a complete binary tree. The maximum number of a child node in a binary heap is at most 2. Implement a Heap Sort Function using C++ In a binary heap, the height of a heap tree is log2N if the heap is... » read more

##### How to parse JSON using PHP

In this example, we will learn how to parse or read a JSON object using PHP built-in function. JSON Let’s create a separate file for the JSON. Copy-paste the following line of the code and save the file as “test.json” {"a":"apple","b":"banana","c":"carrot"} PHP PHP provides two variants of json_decode to parse or read the JSON. Parse... » read more

##### Linear Search in PHP

The following function searches for an element \$x from an array called \$arr by going through each element of the array, one by one. If the element is found in the array, the function returns the index of the element, otherwise, it returns -1. Linear Search function using PHP <?php function search(\$arr, \$x) { for(\$i... » read more

##### Implement Bubble Sort using C++

How to implement Buble Sort method using C++ For example, to sort an array of elements 3,1,2 in ascending order, bubble sort will compare the first pair of adjacent numbers 3 and 1. As 3 is greater than 1, these values will be swapped. The array will be 1,3,2. In the next iteration, 3 and... » read more

##### Implement Bucket Sort using C++

Implement a Bucket Sort method using C++ You can use bucket sort if the input values are distributed uniformly over a given range. Mostly, the bucket sort is used to sort floating-point numbers in the range [0,1] Needless to say, the recursive implementation of the bucket sorting algorithm uses the bucket sorting to sort the... » read more

##### How to find Factorial of a large number using C++

Factorial of a non-negative number n is expressed as n!. Mathematically, Factorial is defined as: By default, the factorial of zero is defined to be 1. For example, if you have to find the factorial of 5, multiple all positive integers less than or equal to 5. There are a few ways to write the... » read more

##### ASP.NET MVC: Pass data from one controller to another using TempData

In this article, you will learn how to pass or send data from one controller to another using TempData object in ASP.NET MVC. What is TempData in ASP.NET MVC? TempData is basically a property of the TempDataDictionary class. It stays for subsequent HTTP requests whereas the ViewData and ViewBag objects stay only for the current... » read more

##### Convert String to Enum and Enum to string in C#

For example, we have the following enum: enum Days { Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday } Convert enum string Use Enum.ToString method To convert an enumeration value to String. Days days = Days.Monday; string stringEnum = days.ToString(); Console.Write(stringEnum); Convert string to enum string strString = "Monday"; Days days = (Days)Enum.Parse(typeof(Days), strString); Or to... » read more

##### Load Text from File to String variable using C#

In this example, we will show you how to load a text file into a string variable in C#. For this purpose, we are going to use the StreamReader.ReadToEnd method to read from a text file on your local machine, or on a network folder. First, you will need to add the namespace below: using... » read more

##### Convert HTML table to JSON string in ASP.NET using C# and JavaScript

In this tutorial, I will explain to you how to convert an HTML table to a JSON string using C#. Convert HTML table to JSON in ASP.NET To get started, insert a static table and an ASP button as shown in the code below: <table class="nav-justified" border="1" id="tblEmployees"> <tr> <td><strong>Name</strong></td> <td><strong>Department</strong></td> </tr> <tr> <td>Jeff</td> <td>IT</td>... » read more

##### Check if a Number is valid using Java

Below is a snippet to check if a number  is valid or not. For example, the string “1.1.1” contains an invalid number, while the string “2.1” contains a valid number. The Code public class Main { public static void main (String[]args) { int i; System.out.println("Enter a Number:"); String str = System.console().readLine (); try { Double.parseDouble(str);... » read more

##### Pass DataTable from Controller to View in ASP.Net MVC

In this article, you are going to learn how to pass a DataTable from a controller to a razor view in ASP.NET MVC. The table passed will be displayed on the view page. Pass DataTable from Controller to View To get started, let’s create a database table like the following: CREATE TABLE [dbo].[Novel]( [NovelID] [int]... » read more

##### Retrieve Items from a LinkedList in Java

Here is another Java snippet that can help to enhance your program by using LinkedLists. The code below will retrieve all items from a linkedList and print them one by one to the console. class Main { public static void main(String[] args) { java.util.LinkedList<String> employees = new java.util.LinkedList<String>(); employees.add("Scott"); employees.add("Marie"); employees.add("Dun"); for (String string :... » read more

##### Convert JSON string to DataTable in ASP.Net using VB.NET

In this article, I’m going to demonstrate with an example, how to convert a JSON string to a DataTable in ASP.NET using VB.NET. for the sake of this articles, I’m gonna create a static JSON file and use IO class to read from it. You can, however, have the JSON string created from a database,... » read more