This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void insertionSort (int[] inputData) { | |
for (int forwardPointer = 1; forwardPointer < inputData.length; forwardPointer++) { | |
int selectElement = inputData[forwardPointer]; | |
int reversePointer = forwardPointer -1; | |
while (reversePointer >= 0 && selectElement < inputData[reversePointer]) { | |
inputData[reversePointer+1] = inputData[reversePointer]; | |
reversePointer--; | |
} | |
inputData[reversePointer + 1] = selectElement; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func insertionSort(inputData: inout [Int]) { | |
for forwardPointer in 1...inputData.count - 1 { | |
let selectElement = inputData[forwardPointer] //Select the element | |
var reversePointer = forwardPointer - 1 //Set the reverse pointer | |
while (reversePointer >= 0 && selectElement < inputData[reversePointer]) { | |
inputData[reversePointer + 1] = inputData[reversePointer] //move the value forward | |
reversePointer -= 1; //decrease the pointer | |
} | |
inputData[reversePointer + 1] = selectElement //store the value at correct place | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Bubble Sort Algorithm | |
func bubbleSort(inputData: inout [Int]) { | |
var inputDataLength = inputData.count | |
while inputDataLength != 0 { | |
var newn = 0 | |
for forwardPointer in 1...inputDataLength - 1 { | |
if (inputData[forwardPointer - 1] > inputData[forwardPointer]) { | |
let temp = inputData[forwardPointer - 1] | |
inputData[forwardPointer - 1] = inputData[forwardPointer] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Bubble Sort in Java | |
public static void bubbleSort(int[] inputData) { | |
int inputDataLength = inputData.length; | |
while (inputDataLength != 0) { | |
int newn = 0; | |
for (int forwardPointer = 1; forwardPointer < inputData.length - 1; forwardPointer++) { | |
if(inputData[forwardPointer - 1] > inputData[forwardPointer]) { | |
final int temp = inputData[forwardPointer - 1]; | |
inputData[forwardPointer - 1] = inputData[forwardPointer]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Binary Search Algorithm | |
func binarySearch ( inputSortedData: [Int], searchElement: Int ) -> Int { | |
var minLeft = 0 | |
var maxRight = inputSortedData.count - 1 | |
while ( minLeft <= maxRight ) { | |
let middleElement = (minLeft + maxRight) / 2 | |
if (searchElement == inputSortedData[middleElement]) { return middleElement + 1; } | |
if (searchElement < inputSortedData[middleElement]) { maxRight = middleElement - 1 } | |
if (searchElement > inputSortedData[middleElement]) { minLeft = middleElement + 1 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int binarySearch(final int[] inputSortedData, final int searchElement) { | |
int minLeft = 0; | |
int maxRight = inputSortedData.length - 1; | |
while ( minLeft <= maxRight ) { | |
final int middleElement = (minLeft + maxRight) / 2; | |
if (searchElement == inputSortedData[middleElement]) { return middleElement + 1; } | |
if (searchElement < inputSortedData[middleElement]) { maxRight = middleElement - 1; } | |
if (searchElement > inputSortedData[middleElement]) { minLeft = middleElement + 1; } | |
} | |
return -1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Remove ShortCode Plugin | |
* | |
* This function will remove the shortcode from getting diplayed. Add this to your function.php | |
* | |
* @author MetaBlogue | |
* @license GPL-2.0+ | |
* @link https://metablogue.com/wordpress-remove-shortcode-plugin/ | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Remove ShortCode Plugin | |
* | |
* This function will remove the shortcode from getting diplayed while keep displaying the content. | |
* Add this to your function.php | |
* | |
* @author MetaBlogue | |
* @license GPL-2.0+ | |
* @link https://metablogue.com/wordpress-remove-shortcode-plugin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Remove ShortCode Plugin | |
* | |
* This function will remove the shortcode from getting diplayed while keep displaying the content. | |
* Add this to your function.php | |
* | |
* @author MetaBlogue | |
* @license GPL-2.0+ | |
* @link https://metablogue.com/wordpress-remove-shortcode-plugin/ |