自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(33)
  • 收藏
  • 关注

原创 邏輯回歸

監督學習(supervised learning)又稱回歸問題(regression problem)只要你給出了一組樣例數據,算法就可以給出答案閾值分類器輸出0.5:如果h(x)>=0.5,預測“y = 1”如果h(x)<0.5,預測“y = 0”              h(x)可以為>1和<0的,但邏輯回歸需要0<=h(x)<=1Sigmoid函數Log...

2018-04-24 13:27:44 242

原创 MSDN的OpenMP範例試運行

A.1 Executing a Simple Loopin Parallel(并行执行简单循环)指令为parallelfor,下面的for回圈将会被并行执行 #ifdef _OPENMP#include <omp.h>#endif #include<stdio.h> int main(){        inta[3] = {1,1,1}, b[3] = {0,0,0}, ...

2018-04-20 18:33:55 164

原创 描述運行時體系結構

為什麼我們對並發(Concurrency)感興趣?軟件可能需要響應看似隨機的外部事件如果有多個CPU可用,並行執行任務可以提高性能例如:一個系統的啟動系統的控制可以通過並發來增強實現並發:並發機制為了支持並發性,系統必須提供多個控制線程常見的並發機制- 多處理(并行)       ◆多個CPU同時執行- 多任務處理(并發)       ◆操作系統通過交錯執行不同任務來模擬單個CPU上的並發性- 基...

2018-04-19 16:17:14 170

原创 用例分析(Usecase Analysis)和类的设计

用例分析用例分析用於解释用例的目的分析以及它在生命周期中的执行位置识别执行事件用例流程的类将用例行为分配给这些类,确定类的责任开发用例模型实现,该模型对所确定的类的实例之间的协作进行建模用例分析包括用例模型(Use-case Model)、類(Analysis Classes)、分析模型(Analysis Model)、用例實現(Use-case Realization)、軟件架構文檔(Softw...

2018-04-18 17:27:02 14478

原创 線性回歸(Linear Regression)

訓練數據的表示方法:X右上角括號裏的數字表示第幾組數據X右下角的數字表示第幾個特徵量組合起來則是第幾組數據的第幾個特徵量通用表逹式每個θ(未知待解系數)和對應的x(我們代入的訓練數據)相乘, 而常數項θ0則與x0相乘,這裏的特徵量x0是我們自己添加上的,默認x0=1。代價函數用作找出一組θ使得函數J的值(偏差)最少,m為數據的組數,n為特徵量總數這裏的為剛剛的通用表逹式,展開即可,i代表每一次數據...

2018-04-18 14:10:26 717

原创 類、包、子系統、接口

類(class)描述一组共享相同职责,关系,操作,属性和语义的对象包(package)将元素组织成组的通用机制可以包含其他模型元素的模型元素不提供行為不完全封裝它們的內容可能不容易替換包有公共可見(public visibility)和私密可見(private visibiliy)兩種類,只有公共可見類能被別的包的類引用子系統(subsystems)完全封裝行為(內容)用清晰的界面代表獨立能力(可...

2018-04-15 21:31:19 250

原创 linux線程的函數整理

線程(thread)線程創建int pthread_create(pthread_t *,const pthread_attr_t *,void *(*)(void *),void *);          //類型pthread_create(&thread_id,&thread_attribute,&thread_fun,&fun_arg);                //形參名threa...

2018-04-15 16:11:19 120

原创 动态规划 数字三角形

        在上面的数字三角形中寻找一条从顶部到底边的路径,使得路径上所经过的数字之和最大。路径上的每一步都只能往左下或 右下走。只需要求出这个最大和即可,不必给出具体路径。 三角形的行数大于1小于等于100,数字为 0 - 99    输入格式:    5      //表示三角形的行数    接下来输入三角形    7    3   8    8   1   0    2   7   4 ...

2018-03-23 19:54:03 112

原创 动态规划-最长公共子串

#include <iostream>#include <vector> #include <string>using namespace std;int main() { int ans = 0; string a, b; cin >> a >> b; vector<vector<int> > v(a.lengt

2018-03-23 15:43:22 83

原创 201503-4 网络延时

问题描述  给定一个公司的网络,由n台交换机和m台终端电脑组成,交换机与交换机、交换机与电脑之间使用网络连接。交换机按层级设置,编号为1的交换机为根交换机,层级为1。其他的交换机都连接到一台比自己上一层的交换机上,其层级为对应交换机的层级加1。所有的终端电脑都直接连接到交换机上。  当信息在电脑、交换机之间传递时,每一步只能通过自己传递到自己所连接的另一台电脑或交换机。请问,电脑与电脑之间传递消息...

2018-03-15 19:43:15 141

原创 201609-3 炉石传说 (C++)

问题描述  《炉石传说:魔兽英雄传》(Hearthstone: Heroes of Warcraft,简称炉石传说)是暴雪娱乐开发的一款集换式卡牌游戏(如下图所示)。游戏在一个战斗棋盘上进行,由两名玩家轮流进行操作,本题所使用的炉石传说游戏的简化规则如下:  * 玩家会控制一些角色,每个角色有自己的生命值和攻击力。当生命值小于等于 0 时,该角色死亡。角色分为英雄和随从。  * 玩家各控制一个英雄...

2018-03-15 12:01:54 712

原创 201609-2 火车购票(C++)

问题描述  请实现一个铁路购票系统的简单座位分配算法,来处理一节车厢的座位分配。  假设一节车厢有20排、每一排5个座位。为方便起见,我们用1到100来给所有的座位编号,第一排是1到5号,第二排是6到10号,依次类推,第20排是96到100号。  购票时,一个人可能购一张或多张票,最多不超过5张。如果这几张票可以安排在同一排编号相邻的座位,则应该安排在编号最小的相邻座位。否则应该安排在编号最小的几...

2018-03-13 19:50:25 1003

原创 201612-2 工资计算

问题描述  小明的公司每个月给小明发工资,而小明拿到的工资为交完个人所得税之后的工资。假设他一个月的税前工资(扣除五险一金后、未扣税前的工资)为S元,则他应交的个人所得税按如下公式计算:  1) 个人所得税起征点为3500元,若S不超过3500,则不交税,3500元以上的部分才计算个人所得税,令A=S-3500元;  2) A中不超过1500元的部分,税率3%;  3) A中超过1500元未超过4...

2018-03-13 13:11:33 139

原创 201703-2 学生排队

问题描述  体育老师小明要将自己班上的学生按顺序排队。他首先让学生按学号从小到大的顺序排成一排,学号小的排在前面,然后进行多次调整。一次调整小明可能让一位同学出队,向前或者向后移动一段距离后再插入队列。  例如,下面给出了一组移动的例子,例子中学生的人数为8人。  0)初始队列中学生的学号依次为1, 2, 3, 4, 5, 6, 7, 8;  1)第一次调整,命令为“3号同学向后移动2”,表示3号...

2018-03-12 17:23:10 146

原创 201709-2 公共钥匙盒 (C++)

问题描述  有一个学校的老师共用N个教室,按照规定,所有的钥匙都必须放在公共钥匙盒里,老师不能带钥匙回家。每次老师上课前,都从公共钥匙盒里找到自己上课的教室的钥匙去开门,上完课后,再将钥匙放回到钥匙盒中。  钥匙盒一共有N个挂钩,从左到右排成一排,用来挂N个教室的钥匙。一串钥匙没有固定的悬挂位置,但钥匙上有标识,所以老师们不会弄混钥匙。  每次取钥匙的时候,老师们都会找到自己所需要的钥匙将其取走,...

2018-03-12 16:58:10 1091

原创 201712-2 游戏

问题描述  有n个小朋友围成一圈玩游戏,小朋友从1至n编号,2号小朋友坐在1号小朋友的顺时针方向,3号小朋友坐在2号小朋友的顺时针方向,……,1号小朋友坐在n号小朋友的顺时针方向。  游戏开始,从1号小朋友开始顺时针报数,接下来每个小朋友的报数是上一个小朋友报的数加1。若一个小朋友报的数为k的倍数或其末位数(即数的个位)为k,则该小朋友被淘汰出局,不再参加以后的报数。当游戏中只剩下一个小朋友时,该...

2018-03-12 16:48:44 274 1

原创 8.12

a.因為k生成樹問題可以在多項式時間內證明,所以k生成樹問題是一個搜索問題。b.在k=2時,2生成樹可以歸為rudrata問題,此情況可以推廣到k生成樹規模。

2017-12-31 23:54:56 129

原创 748. Shortest Completing Word(C++)

原題Find the minimum length word from a given dictionary words, which has all the letters from the string licensePlate. Such a word is said to complete the given string licensePlateHere, f

2017-12-26 12:08:41 223

原创 513. Find Bottom Left Tree Value(C++)

題目Given a binary tree, find the leftmost value in the last row of the tree.Example 1:Input: 2 / \ 1 3Output:1Example 2: Input: 1 / \

2017-12-21 20:58:57 136

原创 442. Find All Duplicates in an Array(C++)

原題Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements that appear twice in this array.Could you do it wi

2017-12-11 22:55:58 160

原创 515. Find Largest Value in Each Tree Row(C++)

原題You need to find the largest value in each row of a binary tree.Example:Input: 1 / \ 3 2 / \ \ 5 3 9 Output: [1, 3, 9]解題思路

2017-12-06 16:53:29 94

原创 419. Battleships in a Board(C++)

原題Given an 2D board, count how many battleships are in it. The battleships are represented with 'X's, empty slots are represented with '.'s. You may assume the following rules:You receive

2017-12-05 18:43:08 209

原创 537. Complex Number Multiplication(C++)

原題Given two strings representing two complex numbers.You need to return a string representing their multiplication. Note i2 = -1 according to the definition.Example 1:Input: "1+1i", "1

2017-12-05 16:58:12 201

原创 654. Maximum Binary Tree(JAVA)

原題Given an integer array with no duplicates. A maximum tree building on this array is defined as follow:The root is the maximum number in the array.The left subtree is the maximum tree const

2017-11-21 19:45:15 209

原创 392. Is Subsequence(JAVA)

題目Given a string s and a string t, check if s is subsequence of t.You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~= 500,000) string,...

2017-11-20 21:44:07 178

原创 144. Binary Tree Preorder Traversal(JAVA)

原題Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree [1,null,2,3], 1 \ 2 / 3return [1,2,3].Note: Recursive sol

2017-11-20 19:26:07 237

原创 677. Map Sum Pairs(JAVA)

題目Implement a MapSum class with insert, and sum methods.For the method insert, you'll be given a pair of (string, integer). The string represents the key and the integer represents the value

2017-11-20 15:28:42 273

原创 445. Add Two Numbers II(JAVA)

原題You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contain a single digit. Add the two numbers and re

2017-11-19 23:35:24 183

原创 477. Total Hamming Distance(C++)

原題The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Now your job is to find the total Hamming distance between all pa

2017-10-22 23:04:43 180

原创 535. Encode and Decode TinyURL(C++)

原題TinyURL is a URL shortening service where you enter a URL such as https://leetcode.com/problems/design-tinyurl and it returns a short URL such as http://tinyurl.com/4e9iAk.Design t

2017-10-15 19:53:01 358 2

原创 462. Minimum Moves to Equal Array Elements II(C++)

原題Given a non-empty integer array, find the minimum number of moves required to make all array elements equal, where a move is incrementing a selected element by 1 or decrementing a selected

2017-10-01 22:48:16 138

原创 540. Single Element in a Sorted Array(C++)

原題Given a sorted array consisting of only integers where every element appears twice except for one element which appears once. Find this single element that appears only once.Example 1:In

2017-09-26 12:01:37 192

原创 665. Non-decreasing Array(C++)

原題如下︰Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element.We define an array is non-decreasing if array[i]  holds for every

2017-09-12 21:09:51 355

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除