- 浏览: 435013 次
- 性别:
- 来自: 深圳
文章分类
- 全部博客 (158)
- J2SE (15)
- c/c++ (17)
- linux & ubuntu (20)
- js (18)
- algorithm (21)
- android (1)
- software (3)
- svn (1)
- db (6)
- other (19)
- css (5)
- go (1)
- html 5 (3)
- computer science (1)
- php (3)
- 创业 (8)
- EJB & jboss (1)
- TDD (1)
- jsp & servlet (2)
- http, tcp & ip (2)
- hibernate (1)
- json (1)
- 乐 (2)
- ps (2)
- netbeans (1)
- extjs (2)
- eclipse (4)
- 项目管理 (1)
- varnish (2)
- study abroad (1)
- python (1)
- erlang (1)
- math (1)
- shell (1)
- assembly (4)
- lucene (1)
- web (1)
- http (1)
- tcp & ip (1)
最新评论
-
yiguxianyun:
...
css li 不换行 -
stdayong:
...
netbeans 中使用 maven -
程序猿_星:
为啥会中文乱码啊
servlet 以 gzip 格式返回数据 -
huanhuan519:
感谢分享~
gdb 调试工具 -
heyl1234:
写过些js,对css还不熟。谢谢~
css li 不换行
max sub_sequence - c
/* problem: there is a sequence of number,could be positive or negative, find out the sub sequence which has max sum, solution: loop the sequence, use maxendinghere to record sum of elements,when sum < 0, set to 0 and go on summation from next element, use maxsofar to record the max sum, each time there is a new maxendinghere, compare with it, and update maxsofar if nessary, use a struct seq_max_result to record the result, which include sum / start / end, efficiency: time is O(n), every efficient, memory is O(1), */ #include <stdio.h> typedef struct { int sum,start,end; } seq_max_result; seq_max_result * seq_max(int *arr,int len) { // start is the start of every maxendinghere int maxsofar = 0,maxendinghere=0,i=0,start=0; static seq_max_result result = {0,0,0}; for(i=0;i<len;i++) { if(maxendinghere+*(arr+i) < 0) { maxendinghere = 0; start = i+1; } else { maxendinghere += *(arr+i); } if(maxsofar<maxendinghere) { maxsofar = maxendinghere; result.start = start; result.end = i; } } result.sum = maxsofar; return &result; } int main() { int arr[10] = {-6,2,7,9,-5,6,9,-10,3,5}; seq_max_result *result = seq_max(arr,10); result = seq_max(arr,10); printf("[%d , %d]: %d\n",result->start,result->end,result->sum); }
发表评论
-
c - linkedlist
2012-05-10 14:52 1018c - linkedlist store ordere ... -
c - word counter (binary-tree)
2012-05-09 14:17 1661c - word counter (binary-tree) ... -
c - pointer is also pass by value
2012-05-09 14:13 919c - pointer is also pass by ... -
find palindromic-prime in pi
2012-04-26 18:32 1786find palindromic-prime in pi ... -
c #define
2012-04-08 13:29 2049c #define macro substitu ... -
c static
2012-04-04 21:59 1177c static static external ... -
c extern
2012-04-04 21:53 1101c extern extern, used to de ... -
int to string by specified base
2012-04-03 22:15 1027int to string by specified base ... -
random select
2011-08-28 01:00 1162random select problem: ... -
sparse data structure - matrix
2011-08-18 20:03 1022sparse data structure sp ... -
binary search - c
2011-08-06 12:07 1037binary search - c (simple) ... -
bit_array - simple use
2011-05-28 23:47 965bit array,use less memory to de ... -
linux c udp
2011-04-01 18:02 2025linux 下可用 c 进行 udp 通信,使用 server ... -
linux c tcp
2011-04-01 18:00 3019linux 下可用 c 进行 tcp 通信,使用 server ... -
gdb 调试工具
2011-02-21 17:20 3222gdb 调试工具 gdb 概 ... -
linkedlist - java 简单实现
2011-02-11 21:29 1547linked list 链表, - ... -
queue (用 java 简单实现)
2011-02-03 01:45 4002queue ------ 结构 线性存 ... -
Medians and Order Statistics (次序统计)
2011-01-03 14:36 2766Medians and Order Statistics - ... -
counting sort
2011-01-02 20:36 1513counting sort ------ counting ... -
quick sort
2011-01-01 20:26 1141quicksort ------ quicksort ove ...
相关推荐
python库。 资源全名:keras_bed_sequence-1.0.6.tar.gz
python库。 资源全名:keras_mixed_sequence-1.0.3.tar.gz
资源分类:Python库 所属语言:Python 资源全名:trytond_stock_location_sequence-5.4.1.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
random_sequence-15eba76f1eed50777b1fccfedd06da14.zip
资源分类:Python库 所属语言:Python 资源全名:pyams_sequence-1.2.0.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
MIPI_Power-on_Sequence.pdf
资源来自pypi官网。 资源全名:fuzzy_sequence_matcher-0.1.1-py2.py3-none-any.whl
求最长公共子序列,求最长公共子序列!!!
The first mode is the Analyze mode in which all GUI tools in MEGA are enabled and visual results explorers are available for tasks such as editing sequence alignments and viewing phylogenies....
Haritpandya-sequence_logo_viewer-archive-refs-heads-master.zip
matlab code for zadoff-chu sequence
使用深度学习方法对RBP结合蛋白识别,使用Python
这是基于MIMO-OFDM的同步算法实现中的训序序列的源程序。
Evaluation of a acf and ccf sequences GOLD
Describe: Positive, negative sequence extractor in simulink.
APNG Assembler is an easy-to-use tool to make Animated PNG from PNG/TGA image sequence. Creates highly optimized APNG files, uses lots of tricks to make them as small as possible. Support zlib, 7zip,...
BRCM_21553_TBird5x_BootSequence-AE.pdf
Contents Page 0 Introduction.................................................................................................................................................................
新兴技术研讨会:思科APIC-EM的网络可编程性 Cisco APIC-EM沙盒实例和凭据 主要使用基于颜色编码的NetAcad APIC-EM沙盒环境地区:目标受众 新兴技术研讨会是一种让学生接触最新互联网技术的短期实践经验。...