Time of Update: 2018-12-03
求兩個字串的乘積,結果存到字串中,例如字串一中存的“657891”,字串二中存的“521”輸出342761211#include<stdio.h>#include<malloc.h>#include<string.h>#include<assert.h>void mul(char *Input1, int n, char *Input2, int m,char *Output);int main(){int n, m;int i = 0;char
Time of Update: 2018-12-03
Computer Graphics, Fall 2000Thomas FunkhouserDepartment of Computer SciencePrinceton UniversityGeneral Information | Textbooks| Coursework | Syllabus| Links |ReferencesStudents | Exercises| Assignments | FinalProjectsGeneral
Time of Update: 2018-12-03
這幾天在公司實習,用Arcgis Engine做項目查help時發現一些小問題,害我在找需要使用的介面和類時折騰了半天,把這些記下來方便大家。(本人所寫模組有個功能是基於DEM的土方計算,使用的是C#)1.RasterSurface 在名字空間ESRI.ArcGIS.Analyst3D下,實現的介面如下InterfacesDescriptionIFunctionalSurface (Geometry)Provides access to information about
Time of Update: 2018-12-03
問題分析:求兩個數組的公用子序列。考慮最長公用子序列問題如何分解成子問題,設A=“a0,a1,…,am-1”,B=“b0,b1,…,bm-1”,並Z=“z0,z1,…,zk-1”為它們的最長公用子序列。不難證明有以下性質:(1) 如果am-1=bn-1,則zk-1=am-1=bn-1,且“z0,z1,…,zk-2”是“a0,a1,…,am-2”和“b0,b1,…,bn-2”的一個最長公用子序列;(2) 如果am-1!=bn-1,則若zk-1!=am-1,蘊涵“z0,z1,…,zk-1”是“a0,
Time of Update: 2018-12-03
國內第一本Django圖書《Django Web開發指南》 歡迎使用Django歡迎來到Django的世界,很高興能和你一起進行這趟旅程。你會發現有了這個強大的Web架構,做每件事情都變得便捷起來—從設計開發新應用到不用大刀闊斧地修改代碼就能為現有代碼提供新的特性和功能。.關於本書市面上已經有了一些講解Django的書籍,但是本書的特別之處在於它著重介紹的三個方面:Django基礎、各種樣本以及Django的進階內容。我們希望寫出一本關於這個主題最完整的教程,無論你的背景是什麼都能讀懂它。同時,
Time of Update: 2018-12-03
liuken@liuken-MS-7798:~$ python manage.py runserverpython: can't open file 'manage.py': [Errno 2] No such file or directoryliuken@liuken-MS-7798:~$ cd /usr/local/binliuken@liuken-MS-7798:/usr/local/bin$ python manage.py runserverpython: can't open
Time of Update: 2018-12-03
因為搜尋引擎的流行,網路爬蟲已經成了很普及網路技術,除了專門做搜尋的Google,Yahoo,微軟,百度以外,幾乎每個大型門戶網站都有自己的搜尋引擎,大大小小叫得出來名字得就幾十種,還有各種不知名的幾千幾萬種,對於一個內容型驅動的網站來說,受到網路爬蟲的光顧是不可避免的。一些智能的搜尋引擎爬蟲的爬取頻率比較合理,對網站資源消耗比較少,但是很多糟糕的網路爬蟲,對網頁爬取能力很差,經常並發幾十上百個請求迴圈重複抓取,這種爬蟲對中小型網站往往是毀滅性打擊,特別是一些缺乏爬蟲編寫經驗的程式員寫出來的爬蟲
Time of Update: 2018-12-03
題目:給出兩個字串,找出這兩個字串的公用子字串。公用子字串和公用序列不同的地方在於 公用子字串要求子串在兩個字串中必須是連續的。例如:“123579” 和 “2378”公用子字串為“23”,公用子序列為“237”動態轉移方程為:如果 xi==yj,則c[i][j] = c[i-1][j-1]+1;如果xi != yj, 則c[i][j] = 0;最後求的的長度為max{c[i][j], 1<=i<=n,
Time of Update: 2018-12-03
輸入一個字串 "abcderabcmnpqabcdmnp",求出這個字串的最長重複字串,這個字串的最長公用字串是abcd。C語言代碼如下:#include<stdio.h>#include<string.h>#include<malloc.h>void HouZhui(char *p);int main(){ char a[100] = "abcderabcmnpqabcdmnp"; HouZhui(a); return 0;}void HouZhui(
Time of Update: 2018-12-03
建立一個通用視圖抽取出我們代碼中共性的東西是一個很好的編程習慣。 比如,像以下的兩個Python函數:def say_hello(person_name): print 'Hello, %s' % person_namedef say_goodbye(person_name): print 'Goodbye, %s' % person_name我們可以把問候語提取出來變成一個參數:def greet(person_name, greeting): print '%s, %s'
Time of Update: 2018-12-03
首先來看編程珠璣上面的一個題目,兩個整數m和n, 其中m < n。輸出時0~n-1範圍內的m個隨機整數的有序列表,不允許重複。方法一:核心思想,如果要從r個剩餘的整數中選出s個,我們以機率s/r選擇下一個數。代碼如下:#include<stdlib.h>#include<stdio.h>#include<assert.h>#include<time.h>void randMfromN(int, int);int bigrand();int
Time of Update: 2018-12-03
#include <iostream>#include <map>#include "gl/glew.h"#include "gl/glut.h"using namespace std;enum FingerJoint{ Shoulder_Joint, //The joint which connects the shoulder to the body. Elbow_Joint, //The joint which connects the two parts
Time of Update: 2018-12-03
如何快速比較這兩個字串是否相等?兩個字串相等的條件如下,字串中的每個字母出現的次數都相等。例如:abbcd和acdbb是相等的,因為a都出現1次,b都出現2次,c都出現3次,d都出現4次。請先給出解題的思路,然後用你熟悉的語言進行具體的代碼實現。(可在答案中註明解題思路)// 比較兩個字串字元計數相等 (要越快越好)bool compare(const char* str1, const char* str2){ int len1 = strlen(str1); int len2 =
Time of Update: 2018-12-03
題目翻譯和代碼有不正確的地方歡迎批評指正.有好的方法歡迎交流。第一題:You are given two 32-bit numbers, N and M, and two bit positions, i and j. Write a method to set all bits between i and j in N equal to M (e.g., M becomes a substring of N located at i and starting at
Time of Update: 2018-12-03
OpenGL Performance OptimizationOpenGL Performance OptimizationYang Jianjyang@cad.zju.edu.cn 這篇文章比較長,希望大家能夠看完。^_^OPenGL State MachineTypical D3D9 Hardware architectureLess State ChangeGL_TRIANGLE_STRIP instead of GL_TRIANGLESTexture LoadingTexture
Time of Update: 2018-12-03
求一個組合函數如p([1,2,3])輸出:[1]、[2]、[3]、[1,2]、[2,3]、[1,3]、[1,2,3]1、遞迴的方法:每次選擇和不選擇這個字元,然後依次遞迴。void Combination(char *str){void Solution(char *, vector<char>&, int);if(str == NULL)return;int n = strlen(str);for(int i = 1; i <= n; ++i)//組合中含有幾個字元{
Time of Update: 2018-12-03
nosql和關係型資料庫比較?優點:1)成本:nosql資料庫簡單易部署,基本都是開源軟體,不需要像使用oracle那樣花費大量成本購買使用,相比關係型資料庫價格便宜2)查詢速度:nosql資料庫將資料存放區於緩衝之中,關係型資料庫將資料存放區在硬碟中,自然查詢速度遠不及nosql資料庫3)儲存資料的格式:nosql的儲存格式是key,value形式、文檔形式、圖片形式等等,所以可以儲存基礎類型以及對象或者是集合等各種格式,而資料庫則只支援基礎類型4)擴充性:關係型資料庫有類似join這樣的多表
Time of Update: 2018-12-03
#include <iostream>using namespace std;template<typename T>class Operation{public:T NumberA;T NumberB;T NumberResult;void SetNumberA(T A){NumberA=A;}T GetNumberA(){return NumberA;}void SetNumberB(T B){NumberB=B;}T GetNumberB(){return
Time of Update: 2018-12-03
求一個全排列函數:如p([1,2,3])輸出:[123]、[132]、[213]、[231]、[321]、[323]1、遞迴的方法:依次把每個字元交換到第一個位置,後面的字元做同樣的遞迴過程。void Permutation(char *str){void PSolution(char *str, int begin, int end);int Length;if(str == NULL || (Length = strlen(str)) == 0)return;PSolution(str, 0
Time of Update: 2018-12-03
1、非遞迴實現二叉樹的三種遍曆2、分層遍曆二叉樹3、找出二叉樹上任意兩個節點的共同父節點4、找出二叉樹中和為某值的所有路徑5、二叉樹的鏡像首先是樹節點和樹的類資料結構#define ElementType intclass BinTree;class BinTreeNode{public:friend class BinTree;BinTreeNode():Left(NULL),Right(NULL){}BinTreeNode(ElementType temp, BinTreeNode *