Tutorial by Examples: a

Maximum subarray problem is the method to find the contiguous subarray within a one-dimensional array of numbers which has the largest sum. The problem was originally proposed by Ulf Grenander of Brown University in 1977, as a simplified model for maximum likelihood estimation of patterns in digiti...
public class MaximumSubarray { private static int Max(int a, int b) { return a > b ? a : b; } static int MaxSubArray(int[] input, int n) { int max = input[0]; int currentMax = input[0]; for (int i = 1; i < n; i++) { ...
Use Update the object name which is stored in reference SYNOPSIS git update-ref [-m <reason>] (-d <ref> [<oldvalue>] | [--no-deref] [--create-reflog] <ref> <newvalue> [<oldvalue>] | --stdin [-z]) General Syntax Dereferencing the symbolic refs, update th...
(input) output = 0 for cycleStart from 0 to length(array) - 2 item = array[cycleStart] pos = cycleStart for i from cycleStart + 1 to length(array) - 1 if array[i] < item: pos += 1 if pos == cycleStart: continue while item == array[pos]: ...
public class CycleSort { public static void SortCycle(int[] input) { for (var i = 0; i < input.Length; i++) { var item = input[i]; var position = i; do { var k = input.Where((t, j) => position != ...
The [record][1] library provides the ability to create compound terms with named fields. The directive :- record/1 <spec> compiles to a collection of predicates that initialize, set and get fields in the term defined by <spec>. For example, we can define a point data structure with nam...
01 some-string PIC X(32). ... MOVE " a string literal" TO some-string DISPLAY ":" some-string ":" DISPLAY ":" FUNCTION TRIM(some-string) ":" DISPLAY ":" FUNCTION TRIM(some-string LEADING) ":" DISPLAY ":" F...
Constraints: Input (an array to be sorted) Number of element in input (n) Keys in the range of 0..k-1 (k) Count (an array of number) Pseudocode: for x in input: count[key(x)] += 1 total = 0 for i in range(k): oldCount = count[i] count[i] = total total += oldCount for...
public class CountingSort { public static void SortCounting(int[] input, int min, int max) { var count = new int[max - min + 1]; var z = 0; for (var i = 0; i < count.Length; i++) count[i] = 0; foreach (int i in input) co...
UNSTRING Input-Address DELIMITED BY "," OR "/" INTO Street-Address DELIMITER D1 COUNT C1 Apt-Number DELIMITER D2 COUNT C2 City DELIMITER D3 COUNT C3 State DELIMITER D4 COUNT C4 Zip-Code DELIMITER D5 COUNT C5 WITH POINTER...
035700 PROCEDURE DIVISION. 035800 035900 DECLARATIVES. 036000 036100 DEPT-HEAD-USE SECTION. USE BEFORE REPORTING DEPT-HEAD. 036200 DEPT-HEAD-PROC. 036300 SET DE-IX TO +1. 036400 SEARCH DEPARTMENT-ENTRY 036500 WHEN DE-NUMBER (DE-IX) = PRR-DEPARTMENT-NUMBER 036600 ...
WRITE record-buff WRITE indexed-record WITH LOCK ON INVALID KEY DISPLAY "Key exists, REWRITING..." END-DISPLAY PERFORM rewrite-key END-WRITE IF indexed-file-status NOT EQUAL ZERO THEN DISPLAY "Write problem: " indexed-file-status UPON SYSERR ...
public class HeapSort { public static void Heapify(int[] input, int n, int i) { int largest = i; int l = i + 1; int r = i + 2; if (l < n && input[l] > input[largest]) largest = l; if (r < n && input[r] ...
public class PigeonholeSort { private static void SortPigeonhole(int[] input, int n) { int min = input[0], max = input[n]; for (int i = 1; i < n; i++) { if (input[i] < min) min = input[i]; if (input[i] > max) max = input[i]; ...
insertSort :: Ord a => [a] -> [a] insertSort [] = [] insertSort (x:xs) = insert x (insertSort xs) insert :: Ord a => a-> [a] -> [a] insert n [] = [n] insert n (x:xs) | n <= x = (n:x:xs) | otherwise = x:insert n xs
public class CatalanNumber { public static int Main(int number) { int result = 0; if (number <= 1) return 1; for (int i = 0; i < number; i++) { result += Main(i)*Main(number - i - 1); } return result; } }
Dynamic Time Warping(DTW) is an algorithm for measuring similarity between two temporal sequences which may vary in speed. For instance, similarities in walking could be detected using DTW, even if one person was walking faster than the other, or if there were accelerations and decelerations during ...
quickSort :: Ord a => [a] -> [a] quickSort [] = [] quickSort (x:xs) = quickSort [ y | y <- xs, y <= x ] ++ [x] ++ quickSort [ z | z <- xs, z > x ]
Few of the eclipse classic versions don't come pre-installed with marketplace, this maybe installed using the following steps: Goto Help → Install new Software Add new Repository(site specified below) General Purpose Tools → Marketplace Client Click Finish and you are done. Marketplace upda...
Before getting started on Processing for Android, make sure you have Processing installed. Open Processing Click on Add Mode... located in the top right of the window: Search for "android" in the Contribution Manager and choose the option that has the author "The Processing Fou...

Page 819 of 1099