This file contains hidden or 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
/** | |
* 查找数组的top K元素 | |
* @param {Array} arr | |
* @param {Number} k | |
*/ | |
function topK(arr, k) { | |
topKRange(arr, 0, arr.length - 1, k); | |
return arr.slice(0, k); | |
} |
This file contains hidden or 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
/** | |
* quick sort an array arr | |
* @param {Array} arr | |
*/ | |
function quickSort(arr) { | |
quickSortRange(arr, 0, arr.length - 1); | |
} | |
/** | |
* quick sort arr[l..h] |
This file contains hidden or 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
/** | |
* marge an array arr | |
* @param {Array} arr | |
*/ | |
function mergeSort(arr) { | |
mergeSortRange(arr, 0, arr.length - 1); | |
} | |
/** | |
* merge sort arr[l..h] |
This file contains hidden or 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
var express = require('express'); | |
var cookieParser = require('cookie-parser'); | |
var session = require('express-session'); | |
var flash = require('express-flash'); | |
var handlebars = require('express-handlebars') | |
var app = express(); | |
var sessionStore = new session.MemoryStore; | |
// View Engines |
This file contains hidden or 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
Consider these queries: | |
SELECT * | |
FROM Orders | |
LEFT JOIN OrderLines ON OrderLines.OrderID=Orders.ID | |
WHERE Orders.ID = 12345 | |
and | |
SELECT * |