Posts

Showing posts from April, 2021

Convert String to Integer in PHP

Converting string to integer or numbers is extremely simple in PHP. PHP programming language supports the type conversion, and it offers numerous functions to convert a string into numbers - php convert array to string .

Quicksort Algorithm Tutorial

Image
  QuickSort is a Divide and Conquer algorithm. It picks an element as pivot and partitions the given array around the picked pivot. There are many different versions of quickSort that pick pivot in different ways. Sorting algorithm are very sensitive to the input data so we will also try different input data to see how they affect the performances - quicksort algorithm javascript . We’ll be going over some of the simple sorting algorithms that every programmer should have a grasp of. We can implement this algorithm using 2 functions. The first called mergeSort, which is the function we’ll call, and another one called _mergeArrays, which takes care of merging the arrays - javascript sort algorithm . Quicksort algorithm is based on the divide and conquer approach where. An array is divided into subarrays by selecting a pivot element (element selected from the array). While dividing the array, the pivot element should be positioned in such a way that elements less than pivot a...

Convert PHP String to Arrays

Image
  The really great thing about this conversion is it’s a one-liner function call. Convert arrays, integers, objects, and variables to string in PHP. We will to use various built-in php functions or methods to deal with string conversion. Converting a string into arrays in PHP is pretty straightforward. PHP offers various methods to convert string to arrays - array to string conversion in php . We are using PHP’s implode function to convert array to a string. The implode function in php takes two parameters. In the first parameter, we pass the separator. This separator is used to separate the arrays, and however, if you don’t pass any argument, then it’ll return an empty separator. In the second parameter, we pass the array object, an array which needs to be converted into a string - php convert array to string . Now, we will covert a php object into the string using the following approach. We are taking help of to_String() and serialize() function help for converting object...

Create New File

Let’s start working with file by creating a new file. To create a file, we are using create New File method that takes filename as an argument. This method creates a new file if file is not alreadyexist - file handling in java .

Quick-Sort Algorithm in JavaScript

Image
  Quick Sort algorithm is one of the most used and popular algorithms in any programming language. But, if you are a JavaScript developer, then you might of heard of sort () which is already available in JavaScript. Then, you might have been thinking what the need of this - quicksort algorithm javascript . To understand this, first we need what is sorting and what is the default sorting in JavaScript. Quick Sort algorithm follows Divide and Conquer approach. It divides elements into smaller parts based on some condition and performing the sort operations on those divided smaller parts - quick sort in javascript . Quick sort is performed until all elements on the left array and right array are sorted. Quick sort is performed on the same array and no new arrays are created in the process. Call Quick sort, passing the array and left-pointer and right-pointer to the quickSort function. For more information, please visit our site http://codingpanel.com/