Time of Update: 2018-12-04
/*binary_heap.c -- 二元堆積實現檔案*/#include <stdio.h>#include <stdlib.h>#include "binary_heap.h"/*局部函式宣告*//*返回 item 在 position 位置處上濾後應該出現堆中的位置索引*/static int Percolate_Up (const Heap * const pheap, const Item item, const int position) ;/*返回
Time of Update: 2018-12-04
/*PairingHeap.c -- 配對堆實現檔案*/#include "PairingHeap.h"/*全域變數聲明*/static Node * NullNode = NULL ;/*局部函式宣告*/static Node * compareAndLink_P (Node * const first, Node * const second) ;static Node * makeNode_P (const Item item) ;static Node *
Time of Update: 2018-12-04
using System;using System.Collections.Generic;using System.Text;namespace ConsoleApplication1{ class Program { static void Main(string[] args) { //1.將字串中的一些字母替換 string a = "123abc"; for (int i = 1;
Time of Update: 2018-12-04
/*open_addressing_hash_with_hashing_again.c -- 開放定址散列表線性探測法可再散列實現檔案*/#include <stdio.h>#include <stdlib.h>#include "open_addressing_hash_with_hashing_again.h"/*局部函式宣告*/static int Get_Prime_Value (const int size) ;static int Is_A_Prime
Time of Update: 2018-12-04
排序的穩定性,是指排序前後,相同元素的位置先後關係是否改變.穩定排序,是位置先後關係不變.不穩定排序,是先後位置關係改變,當然,也存在不改變的可能.更說明了他的不穩定.可笑吧?哈哈... <<AtA>>的一道課後習題,問了幾種常見排序的穩定性問題,以及如何將不穩定排序改為穩定排序.為了探尋這個問題,我決定動手寫出這些排序.這是昨天的事,昨天開始寫的.到現在寫完了,中途幹了許多別的事情. 還是第一次,默寫這些個排序.收穫很多,可以說,最起碼克服了默寫這些排序的恐懼.
Time of Update: 2018-12-04
/*9-18(b)-12-19-00.49.c -- 第九章第十八題*/#include <stdio.h>#include <stdlib.h>#include "binary_heap_for_kruskal.h"#include "disjiont_set.h"#define SIZE (10)int main (void) ;void kruskal (const Adjacenty_List * const padj, const Hash_Table *
Time of Update: 2018-12-04
/*adjacenty_list.c -- 鄰接表實現檔案*/#include <stdio.h>#include <stdlib.h>#include "adjacenty_list.h"/*局部函式宣告*/Vertex * Make_Vertex (const Name vertex) ;/*介面函數定義*/int CreateAdjacent_List (Adjacent_List * const padj, const int capacity){int
Time of Update: 2018-12-04
/*new_adjacenty_list.c -- 鄰接表實現檔案*/#include <stdio.h>#include <stdlib.h>#include "new_adjacenty_list.h"/*局部函式宣告*/static Adjoin_To_Vertex * Make_Adjoin_To_Vertex (const Hash_Table * const pht, const Name name, const int cvw)
Time of Update: 2018-12-04
/*9-10(b)-12-13-20.26.c -- 第九章第十題(b)*/#include <stdio.h>#include <stdlib.h>#include "binary_heap.h"int main (void) ;int new_dijkstra (const Adjacenty_List * padj, const Hash_Table * const pht, const int start) ;int main
Time of Update: 2018-12-04
起初選擇使用ADT的操作來實現分配儲存空間.後來發現.這樣做,問題很多,以至於分析了一會沒有分析出什麼結果.索性直奔問題了,我的思想是好的,我承認. 上代碼./*DisjiontADT.c -- 不相交集合實現檔案*/#include <stdio.h>#include <stdlib.h>#include "DisjiontADT.h"/*介面函數定義*/void InitializeAsHeight (DisjiontSet gather, const int
Time of Update: 2018-12-04
....最近的作品,實在是少得可憐. 不過還好,總比沒有得要好. 這個東西,是分治演算法的例子,是按照思路實現起來的,總體說來,還算不錯.希望接下來的,能實現得更自然./*10-16-11-01-22-23.17.c -- 第十章第十六題*//*有問題存在,偶爾出現段錯誤.偶爾出現計算錯誤.這道習題耽誤太久了,先不去研究了. -- 11-01-27-21.49*/#include <stdio.h>#include <stdlib.h>#include
Time of Update: 2018-12-04
老樣子,跟著演算法導論走.//graphRepresentAsAdjacentList.h -- graph header file.//2011-09-02-19.38 -- 2011-09-02-21.47//Purpose://Define a class "graphRepresentAsAdjacentList".//Declare methods of the class, and define element member.#include <iostream>#
Time of Update: 2018-12-04
為使用malloc分配空間時報錯,錯誤碼如下:malloc.c:3096: sYSMALLOc: Assertion `(old_top == (((mbinptr) (((char *) &((av)->bins[((1) - 1) * 2])) – __builtin_offsetof (struct malloc_chunk, fd)))) && old_size == 0) || ((unsigned long) (old_size) >=
Time of Update: 2018-12-04
規律:1). 每一個成員的地址能夠被它本身位元組數整除; 2). 最後總的位元組數必須能夠被最大位元組數的成員整除; 3). 一般可以以地址0為起始地址來考慮。否則的話就會產生補位。例如:typedef struct test {char a; //2bytesint b; //1byteschar d[21]; //20bytesdouble f;};結果sizeof(test)=4。實際上,1
Time of Update: 2018-12-04
orz下死月先。然後表示離散神馬的忘光了。一筆畫神馬的奇數度的點只有<=2個啊然後map<node,int>還有一點就是map是要鍵類型必須定義<操作符,而且該操作符能夠正確的工作,實際上map底層有紅/黑樹狀結構實現。根據二叉樹的特點重構<(感謝芒果==)#include<iostream>#include<cstdio>#include<cstring>#include<map>using namespace
Time of Update: 2018-12-04
1.把C++當成一門新的語言學習(和C沒啥關係!真的。); 2.看《Thinking In C++》,不要看《C++變成死相》; 3.看《The C++ Programming Language》和《Inside The C++ Object
Time of Update: 2018-12-04
搬運自:http://hi.baidu.com/evergreen19/blog/item/dbc1d5f13241c3a5a50f5245.html最近開始寫,RC4,由於要使用不少的swap,所以swap的演算法效率對RC4的整體速度是有著不小的影響的,因此總結了一些不錯的交換演算法與大家共用。int a=5,b=7;方法一: 內聯彙編,利用堆棧區 -- Swapping containers__asm{ push a push b pop a
Time of Update: 2018-12-04
做法:進行從小到大排序,這樣可以使最接近的幾個數都聚在一起,然後用(i-j+1)*a[i]-sum;sum-=a[j++];這樣可以以i-j+1為重複次數,算出重複最多的數,然後以為是從小到大排列的,又可以找出最小數。#include <iostream>#include <cstdio>#include <algorithm>#include <cmath>#include <utility>#define LL long long#
Time of Update: 2018-12-04
做法:傳統多重背包,好久沒做背包,有些地方確實要注意一下了...#include <iostream>#include <cstdio>using namespace std;int lim[12],dp[12][1003],c[12],d[12];int max(const int &a,const int &b){ return a>b?a:b;}int main(){ int n,m; lim[0]=-1; scanf(
Time of Update: 2018-12-04
C# WinForm下實現的發送郵件案例下載 using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Net;using System.Net.Sockets;namespace SendMail{