Skip to content

Instantly share code, notes, and snippets.

View swayamraina's full-sized avatar
🐢
don't be afraid of moving slow, speed is a relative concept!

Swayam Raina swayamraina

🐢
don't be afraid of moving slow, speed is a relative concept!
View GitHub Profile
#!/usr/bin/env python
import sys
import re
commit_regex = '\[#[0-9]+\] : [a-zA-Z ]+(\n[a-zA-Z 0-9.])+'
error_message = "\
Aborting commit. Please ensure your commit message meets the standard requirement. \n\n \
var i=0;
while(i<1000000000) i++;
// or
processImage = function() {
// code to do image analysis
}
console.log("Hi! ");
setTimeout(function() {
console.log("tech");
},5000);
console.log("I <3 ");
console.log("Hi! ");
setTimeout(function() {
console.log("tech");
},0);
console.log("I <3 ");
console.log("about to do a GET request");
$.get('https://www.google.co.in/search?q=swayam+raina',
function(data) {
console.log("completed network request");
});
console.log("GET request pushed to WebAPI block");
/**
* @param a the array in which a run is to be counted and possibly reversed
* @param lo index of the first element in the run
* @param hi index after the last element that may be contained in the run.
It is required that {@code lo < hi}.
* @param c the comparator to used for the sort
*
* @return the length of the run beginning at the specified position in
* the specified array
/**
* Returns the minimum acceptable run length for an array of the specified
* length.
*
* @param n the length of the array to be sorted
* @return the length of the minimum run to be merged
*/
private static int minRunLength(int n) {
assert n >= 0;
Exception in thread "main" java.lang.IllegalArgumentException: Comparison method violates its general contract!
at java.util.TimSort.mergeLo(TimSort.java:777)
at java.util.TimSort.mergeAt(TimSort.java:514)
at java.util.TimSort.mergeForceCollapse(TimSort.java:457)
at java.util.TimSort.sort(TimSort.java:254)
at java.util.Arrays.sort(Arrays.java:1512)
at java.util.ArrayList.sort(ArrayList.java:1454)
at java.util.Collections.sort(Collections.java:175)
...
...
private void displayStudents(List<Student> students, Strategy strategy, Filter filter) {
if (null != filter) Filter.apply(students, filter);
if (null != strategy) {
Function strategyFunction = Strategy.getStrategy(strategy);
Collections.sort(students, Comparator.comparing(strategyFunction));
}
}
RUN 1:
+--------------+--------------+
| Type | Time |
+--------------+--------------+
| | |
| Imperitive | 1ms |
| Sequential | 61ms |
| Parallel | 4ms |
| | |
+--------------+--------------+