在pptv的实习结束了, 忙着找工作的事,顺便把数据结构的那本书重新复习了一遍.为了加深印象,特意把里面的常用的排序.查找算法用js写了一遍 具体的实例在我的github上,大家可以访问的: https://github.com/chenkehxx/practice js_sort.html文件 //js插入排序 function insertSort(arr){ var result =[]; result.push(arr[0]); for(var i = 1, len = arr.…
1. ASCII(American Standard Code for Information Interchange) (1)数字0-9对应ASCII编码十进制为48-57, 字母a-z对应ASCII编码十进制为97-122,字母A-Z对应ASCII编码十进制为65-90 (2)char转成int类型的时候,类型自动提升,char数据类型,会查询编码表,得到整数 int转成char类型的时候,强制转换,会查询编码表 (3) char存储汉字,查询Unicode编码表 (4) char可以…
这篇文章关于STL中的排序写的虽不深入,但是还是挺好的. 1.sort sort有两种形式,第一种形式有两个迭代器参数,构成一个前开后闭的区间,按照元素的 less 关系排序:第二种形式多加一个指定排序准则的谓词.sort基本是最通用的排序函数,它使用快速排序算法,并且在递归过程中,当元素数目小于一个阈值(一般是16,我的试验是24)时,转成直接插入排序.伟大的数学家Knuth已经证明,在平均意义上,快速排序是最快的了:当然,最坏复杂性比较差.sort要求随机迭代器,因此对于很多编译器来说,对于…
B. XK Segments time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output While Vasya finished eating his piece of pizza, the lesson has already started. For being late for the lesson, the teacher sug…
水果 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 9855 Accepted Submission(s): 3934 Problem Description 夏天来了~~好开心啊,呵呵,好多好多水果~~Joe经营着一个不大的水果店.他认为生存之道就是经营最受顾客欢迎的水果.现在他想要一份水果销售情况的明细表,这样Joe就可以很容易掌…
D. Divide by three, multiply by two time limit per test 1 second memory limit per test 256 megabytes input:standard input output:standard output Polycarp likes to play with numbers. He takes some integer number x, writes it down on the board, and the…
Greatest Number 题目描述Saya likes math, because she think math can make her cleverer.One day, Kudo invited a very simple game:Given N integers, then the players choose no more than four integers from them (can be repeated) and add them together. Finally…
A. Diversity time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Calculate the minimum number of characters you need to change in the string s, so that it contains at least k different letters,…