- 博客(31)
- 收藏
- 关注
转载 监督学习应用与梯度下降
文章转载自http://blog.sina.com.cn/s/blog_8e6f1b330101eu3b.html 监督学习:告诉算法每个样本的正确答案,学习后的算法对新的输入也能输入正确的答案 。监督指的是在训练样本答案的监督下。1、 线性回归例:Alvin汽车,先让人开车,Alvin摄像头观看(训练),而后实现自动驾驶。本质是一个回归问题,汽车尝试预测行驶方向。
2015-01-03 16:13:42 420
原创 c++primer第五版课后练习答案(第六章)
chapter6_6.3int fact(int val){ int ret = 1; while (val > 1) ret *= val--; return ret;}chapter6_6.4#include "stdafx.h"#include using namespace std;int fact(int val){ int ret = 1; w
2014-12-18 20:09:53 906
原创 MFC实现一个简单的计算器
在VS2013环境下用MFC实现一个简单的计算器,主要是为了熟悉MFC编辑框的使用和消息传递机制。实现步骤:1、在工具箱托两个Edit control,一个显示可见,另一个不可见(用于保存操作数),分别为其添加CString类型的变量m_str1,m_str22、添加button按钮,分别表示0—9,左击添加响应处理函数void Cdemo2Dlg::OnBnClicked
2014-12-12 14:55:04 10593 5
原创 c++primer第五版课后练习答案(第十章)
chapter10_10.1#include "stdafx.h"#include #include #include using namespace std;int _tmain(int argc, _TCHAR* argv[]){ vector ivec = {1,2,3,2,5,6}; int num = 0; num = count(ivec.cbegin(),
2014-12-09 15:14:17 716
原创 MFC实现一个简单的加法器
在MFC中实现一个简单的加法器工具:Visual Studio 2013步骤:1、打开VS2013,选择文件->新建项目->项目,选择MFC程序,项目名称为Add,点击确定,MFC应用程序向导对话框,选择“应用程序类型->基于对话框”,其他选项保持默认值不变,点击完成。2、编辑对话框资源将相应控件添加到相应位置,如图所示3、向应用程序加入成员函数
2014-12-08 19:04:18 7209
原创 LeetCode—Remove Duplicates from Sorted Array II
题目:Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?For example,Given sorted array A = [1,1,1,2,2,3],Your function should return length = 5, and A is now
2014-11-24 20:20:48 333
原创 LeetCode—Remove Duplicates from Sorted Array
题目Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in plac
2014-11-24 19:31:11 338
原创 LeetCode—Swap Nodes in Pairs
题目:Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constant
2014-11-10 16:39:26 365
原创 LeetCode—Merge Two Sorted Lists
题目:Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.解题思路:此处要求
2014-10-31 15:55:13 344
原创 LeetCode—Length of Last Word
题目:Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string.If the last word does not exist, return 0.Note: A
2014-10-31 14:46:06 359
原创 LeetCode—TowSum
题目:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the
2014-10-30 22:42:27 483
原创 LeetCode——Merge Sorted Array
Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements from
2014-10-30 21:06:44 324
原创 LeetCode——Remove Element
题目:Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't matter what you leave beyond the new lengt
2014-10-27 14:54:20 309
原创 LeetCode—Search Insert Position
题目:Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the
2014-10-27 14:53:36 303
原创 LeetCode—Single Number
Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using ext
2014-10-26 21:23:45 314
原创 vc环境下的窗口程序
#include#includeLRESULT CALLBACK WndProc(HWND hMainWnd,UINT message,WPARAM wParam,LPARAM lparam);char szClassName[]="windowscalss1";//窗口结构体名称char szAppTitle[]="windows API";int WINAPI WinMain(HIN
2014-09-25 15:43:03 463
原创 统计相同数字的个数
/*程序读入一个int数组,假定数组项小于50,输出结果为两列:第一列是各个不同的数组元素,第二列是每个元素在数组中出现的次数的总和。第一列中的内容应该是从大到小排序。例如:对于数组值:-12,3,-12,4,1,1,-12,1,-1,1,2,3,4,2,3,-12输入形式:N Count4 23 32 21 4
2014-09-14 13:52:19 766
转载 实参和形参的区别和用法
#include using namespace std;void getNum(int &a,int &b){ cout<<"输入两个数:"<<endl; cin>>a>>b;}void changeNum(int &c,int &d){ int temp; temp=c; c=d; d=temp;}void show(int e,
2014-09-12 21:41:17 1148
原创 图的深度优先遍历算法
#include #include #define MAXVEX 100typedef struct{ char vexs[MAXVEX]; int arc[MAXVEX][MAXVEX]; int numVertexes,numEdges; //顶点数和边数}MGraph;void CreateMGraph(MGraph *G){ int
2014-09-12 19:28:51 353
原创 c语言实现单链表创建和遍历
#include#includetypedef struct Node{ int data; struct Node *next;}Node,*Linklist;Node *creat_List_a()//尾插法建立单链表{ Linklist L; Node *p; int temp; L=(Linklist)malloc(sizeof(
2014-09-06 21:32:28 683
原创 JDBC连接MySQL数据库及示例
import java.sq;.*;public class demo{ public static void main(String [] args) throws Exception { String driver="com.mysql.jdbc.Driver"; String url="jdbc:mysql//localhost:33306/mydb" String
2014-05-17 13:23:59 495
原创 Java学习小问题
“hello”直接量和new string (“hello”)的区别?答:当Java程序直接使用形如“hello”的字符串常量,JVM将会使用常量池来管理这些字符串;当使用new string (“hello”)时,JVM会先使用常量池来管理直接量,再调用String类的构造器来创建一个新的String对象,新创建的String对象被保存在堆内存中。换句话说,new string (“he
2014-04-09 14:18:43 379
原创 快速排序Java语言实现
//快速排序;public class Demo{public static void main(String[] args){try{int a[]=new int[]{1,5,7,9,12,4};for(int i=0;iSystem.out.println(a[i]);System.out.println("------------");qSort
2014-04-09 14:04:03 409
原创 在数组中查找某一指定数组元素
在数组中查找某一指定数组元素,可设查找标志flag在数组s[n]中查找tempint flag=0;for(int i=0;i {if(temp==s[i]){printf("数组含有该元素");flag=1;break;} }if(flag==0)printf("数组不含有该元素");
2014-03-17 11:34:58 2344
原创 判断一个数是否为对称的数
方法一:int m;while(n) { m=m*10+n%10; n=n/10; }if(m==n)printf("是对称的");方法二:用栈判断int data[200],i=0,k,j;do { data[i++]=x%10;x=x/10; }while(x>0);for(j=0,k=i-1
2014-03-17 11:31:34 10467 3
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人