Algorithm
文章平均质量分 78
NCITS
这个作者很懒,什么都没留下…
展开
-
【Algorithm】基础算法学习
1.猜价格游戏 #include #include int main(void) { int oldprice,price = 0 ,i= 0; printf("请输入真实商品的价格:"); scanf("%d",&oldprice); system("cls"); printf("请输入试猜的价格:\n"); while(oldprice != price) { i++原创 2015-03-15 18:28:25 · 869 阅读 · 0 评论 -
【Algorithm】算术表达式求值------逆波兰RPN
一.问题描述 简单算术表达式:只包含“+”、“-”、“*”、“/”、正整数和括号的算术表达式并且是合法数学表达式。 二.后缀表示法(RPN) 参考资料:《大话数据结构》 p104 表达式计算,即符合“先乘除,后加减,从左到右,先括号内后括号外”这个运算规则就行。算法方式有很多,此处只谈RPN(Reverse Polish Notation)。 算法核心: (1)将中缀表达式原创 2015-05-05 19:25:04 · 955 阅读 · 0 评论 -
【Algorithm】最大连续子数组和
/* * MaxSumArray.c * * Created on: 2015年5月5日 * Author: weike */ #include int besti,bestj;//返回位置i,位置j /** * algorithm 1 暴力法O(n^3) */ int MaxSum1(int n,int *a){ int sum = 0; int i,j,k; f原创 2015-05-06 11:30:36 · 637 阅读 · 0 评论