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
void selection_sort (int A[ ], int n) { | |
// temporary variable to store the position of minimum element | |
int minimum; | |
// reduces the effective size of the array by one in each iteration. | |
for(int i = 0; i < n-1 ; i++) { | |
// assuming the first element to be the minimum of the unsorted array . | |
minimum = i ; |
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
(function() { | |
console.log(typeof foo); // function pointer | |
console.log(typeof bar); // undefined | |
var foo = 'hello', | |
bar = function() { | |
return 'world'; | |
}; |
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
fooExecutionContext = { | |
scopeChain: { ... }, | |
variableObject: { | |
arguments: { | |
0: 22, | |
length: 1 | |
}, | |
i: 22, | |
c: pointer to function c() | |
a: 'hello', |
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
fooExecutionContext = { | |
scopeChain: { ... }, | |
variableObject: { | |
arguments: { | |
0: 22, | |
length: 1 | |
}, | |
i: 22, | |
c: pointer to function c() | |
a: undefined, |
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
function foo(i) { | |
var a = 'hello'; | |
var b = function privateB() { | |
}; | |
function c() { | |
} | |
} |
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
executionContextObj = { | |
'scopeChain': { /* variableObject + all parent execution context's variableObject */ }, | |
'variableObject': { /* function arguments / parameters, inner variable and function declarations */ }, | |
'this': {} | |
} |
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
(function foo(i) { | |
if (i === 3) { | |
return; | |
} | |
else { | |
foo(++i); | |
} | |
}(0)); |
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 factorial(x: Int) -> Int { | |
// The body of the function goes here... | |
} |
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
fun factorial(x: Int): Int { | |
// The body of the function goes here... | |
} |
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
use std::thread; | |
use std::sync::mpsc; | |
fn main() { | |
let (tx, rx) = mpsc::channel(); | |
for _ in 0..10 { | |
let tx = tx.clone(); | |
thread::spawn(move || { | |
let result = 77u32; |