锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产成人精品三上悠亚久久,国产精品无码久久久久,久久久国产精华液http://www.shnenglu.com/dqchen/category/3986.html鍐欏嚭涓涓彲浠ュ伐浣滅殑紼嬪簭騫朵笉澶?/description>zh-cnWed, 21 May 2008 10:02:27 GMTWed, 21 May 2008 10:02:27 GMT60BinaryHeaphttp://www.shnenglu.com/dqchen/articles/21538.htmlDainDainMon, 09 Apr 2007 08:05:00 GMThttp://www.shnenglu.com/dqchen/articles/21538.htmlhttp://www.shnenglu.com/dqchen/comments/21538.htmlhttp://www.shnenglu.com/dqchen/articles/21538.html#Feedback0http://www.shnenglu.com/dqchen/comments/commentRss/21538.htmlhttp://www.shnenglu.com/dqchen/services/trackbacks/21538.html浠ュ悜閲忓瓨鍌紝涓嬫爣浠?寮濮?/p>
// 鏋勫緩鍫?/span>
void BuildHeap(vector<int> & BinaryHeap)
{
    
int size = (int)BinaryHeap.size();
    
int i,j,k,l;

    
for(i = size / 2 - 1;i >= 0;--i)
    
{
        j 
= i;
        
        
while(true)
        
{
            k 
= 2 * j;
            l 
= k + 2;
            k 
= k + 1;

            
if(l < size)
            
{
                
if(BinaryHeap[j] > min(BinaryHeap[k],BinaryHeap[l]))
                
{
                    
if(BinaryHeap[l] > BinaryHeap[k])
                    
{
                        swap(BinaryHeap[j],BinaryHeap[k]);
                        j 
= k;
                    }

                    
else
                    
{
                        swap(BinaryHeap[j],BinaryHeap[l]);
                        j 
= l;
                    }

                }

                
else
                    
break;
            }

            
else if(k < size)
            
{
                
if(BinaryHeap[j] > BinaryHeap[k])
                
{
                    swap(BinaryHeap[j],BinaryHeap[k]);
                    j 
= k;
                }

                
else
                    
break;
            }

            
else
                
break;
        }

    }

}

// 鎻掑叆
void insert(vector<int> & BinaryHeap,int x)
{
    
int size = (int)BinaryHeap.size();
    
int i = size + 1;
    BinaryHeap.resize(i);

    
int j = i / 2 - 1;
    
while(j >= 0 && BinaryHeap[j] > x)
    
{
        BinaryHeap[i 
- 1= BinaryHeap[j];
        i 
= j + 1;
        j 
= (j + 1/ 2 - 1;
    }

    BinaryHeap[i 
- 1= x;
}

// 鍒犻櫎鏈灝忓厓
int DeleteMin(vector<int> & BinaryHeap)
{
    
int size = (int)BinaryHeap.size();
    
int min = BinaryHeap[0],last = BinaryHeap[size - 1];

    
int i,child;
    
for(i = 0;i * 2 + 2 < size;i = child)
    
{
        
// find smaller child
        child = i * 2 + 1;
        
if(child < size && BinaryHeap[child + 1< BinaryHeap[child])
            
++child;
        
        
// percolate one level
        if(BinaryHeap[child] < last)
            BinaryHeap[i] 
= BinaryHeap[child];
        
else
            
break;
    }

    BinaryHeap[i] 
= last;
    BinaryHeap.resize(size 
- 1);

    
return min;
}

 




Dain 2007-04-09 16:05 鍙戣〃璇勮
]]>
TopSorthttp://www.shnenglu.com/dqchen/articles/21491.htmlDainDainSun, 08 Apr 2007 07:42:00 GMThttp://www.shnenglu.com/dqchen/articles/21491.htmlhttp://www.shnenglu.com/dqchen/comments/21491.htmlhttp://www.shnenglu.com/dqchen/articles/21491.html#Feedback0http://www.shnenglu.com/dqchen/comments/commentRss/21491.htmlhttp://www.shnenglu.com/dqchen/services/trackbacks/21491.htmlvoid TopSort(vector< vector<int> > AdjacencyMatrix)
{
 queue<int> q;
 int i,j;
 int size = (int)AdjacencyMatrix.size();

 vector<int> inDegree(size,0);
 for(i = 0;i < size;++i)
 {
  for(j = 0;j < size;++j)
   if(AdjacencyMatrix[j][i] == 1)
    ++inDegree[i];
  if(inDegree[i] == 0)
   q.push(i);
 }

 int v;
 while(!q.empty())
 {
  // output
  v = q.front();
  q.pop();

  for(i = 0;i < size;++i)
  {
   if(AdjacencyMatrix[v][i] == 1)
    --inDegree[i];
   if(inDegree[i] == 0)
    q.push(i);
  }
 }

 if(!q.empty())
  cerr << "Graph has a cycle" << endl;
}



Dain 2007-04-08 15:42 鍙戣〃璇勮
]]>
緇熻鍑芥暟NormSDist鍜孨ormSInv鍑芥暟瀹炵幇http://www.shnenglu.com/dqchen/articles/19772.htmlDainDainTue, 13 Mar 2007 12:52:00 GMThttp://www.shnenglu.com/dqchen/articles/19772.htmlhttp://www.shnenglu.com/dqchen/comments/19772.htmlhttp://www.shnenglu.com/dqchen/articles/19772.html#Feedback2http://www.shnenglu.com/dqchen/comments/commentRss/19772.htmlhttp://www.shnenglu.com/dqchen/services/trackbacks/19772.html鍏堣涓嬩粖澶╁啓VBA瀛﹀埌鐨勶紝閭e氨鏄疎xcel鐨勭粺璁″伐浣滆〃鍑芥暟銆?br>Excel鐨勭粺璁″伐浣滆〃鍑芥暟鐢ㄤ簬瀵規暟鎹尯鍩熻繘琛岀粺璁″垎鏋愩備緥濡傦紝緇熻宸ヤ綔琛ㄥ嚱鏁板彲浠ョ敤鏉ョ粺璁℃牱鏈殑鏂瑰樊銆佹暟鎹尯闂寸殑棰戠巼鍒嗗竷絳夈傛槸涓嶆槸瑙夊緱濂藉儚鏄緢涓撲笟鑼冪暣鐨勪笢瑗匡紵鏄殑錛岀粺璁″伐浣滆〃鍑芥暟涓彁渚涗簡寰堝灞炰簬緇熻瀛﹁寖鐣寸殑鍑芥暟錛屼絾涔熸湁浜涘嚱鏁板叾瀹炲湪浣犳垜鐨勬棩甯哥敓媧諱腑鏄緢甯哥敤鐨勶紝姣斿姹傜彮綰у鉤鍧囨垚緇╋紝鎺掑悕絳夈?br>浣嗘槸鎴戠殑紼嬪簭鏄cpp瀹炵幇涓婇潰淇╀釜鍑芥暟錛屽彲鏄痗pp娌℃湁榪欐牱鐨勭粺璁″嚱鏁般傛煡浜嗗ソ澶氳祫鏂欙紝鎵懼埌浜嗗欏瑰紡榪戜技鐨勬柟娉曪細
/***************************************************************/
/* 榪斿洖鏍囧噯姝f佸垎甯冪殑绱Н鍑芥暟錛岃鍒嗗竷鐨勫鉤鍧囧間負 0錛屾爣鍑嗗亸宸負 1銆?nbsp;                          */
/***************************************************************/
double NormSDist(const double z)
{
 // this guards against overflow
 if(z > 6) return 1;
 if(z < -6) return 0;

 static const double gamma =  0.231641900,
      a1  =  0.319381530,
      a2  = -0.356563782,
      a3  =  1.781477973,
      a4  = -1.821255978,
      a5  =  1.330274429;

 double k = 1.0 / (1 + fabs(z) * gamma);
 double n = k * (a1 + k * (a2 + k * (a3 + k * (a4 + k * a5))));
 n = 1 - Normal(z) * n;
 if(z < 0)
  return 1.0 - n;

 return n;
}


/***************************************************************/
/* 榪斿洖鏍囧噯姝f佸垎甯冪瘡縐嚱鏁扮殑閫嗗嚱鏁般傝鍒嗗竷鐨勫鉤鍧囧間負 0錛屾爣鍑嗗亸宸負 1銆?/font> 
 
                  */
/***************************************************************/
double normsinv(const double p)
{
 static const double LOW  = 0.02425;
 static const double HIGH = 0.97575;

 /* Coefficients in rational approximations. */
 static const double a[] =
 {
  -3.969683028665376e+01,
   2.209460984245205e+02,
  -2.759285104469687e+02,
   1.383577518672690e+02,
  -3.066479806614716e+01,
   2.506628277459239e+00
 };

 static const double b[] =
 {
  -5.447609879822406e+01,
   1.615858368580409e+02,
  -1.556989798598866e+02,
   6.680131188771972e+01,
  -1.328068155288572e+01
 };

 static const double c[] =
 {
  -7.784894002430293e-03,
  -3.223964580411365e-01,
  -2.400758277161838e+00,
  -2.549732539343734e+00,
   4.374664141464968e+00,
   2.938163982698783e+00
 };

 static const double d[] =
 {
  7.784695709041462e-03,
  3.224671290700398e-01,
  2.445134137142996e+00,
  3.754408661907416e+00
 };

 double q, r;

 errno = 0;

 if (p < 0 || p > 1)
 {
  errno = EDOM;
  return 0.0;
 }
 else if (p == 0)
 {
  errno = ERANGE;
  return -HUGE_VAL /* minus "infinity" */;
 }
 else if (p == 1)
 {
  errno = ERANGE;
  return HUGE_VAL /* "infinity" */;
 }
 else if (p < LOW)
 {
  /* Rational approximation for lower region */
  q = sqrt(-2*log(p));
  return (((((c[0]*q+c[1])*q+c[2])*q+c[3])*q+c[4])*q+c[5]) /
   ((((d[0]*q+d[1])*q+d[2])*q+d[3])*q+1);
 }
 else if (p > HIGH)
 {
  /* Rational approximation for upper region */
  q  = sqrt(-2*log(1-p));
  return -(((((c[0]*q+c[1])*q+c[2])*q+c[3])*q+c[4])*q+c[5]) /
   ((((d[0]*q+d[1])*q+d[2])*q+d[3])*q+1);
 }
 else
 {
  /* Rational approximation for central region */
      q = p - 0.5;
      r = q*q;
  return (((((a[0]*r+a[1])*r+a[2])*r+a[3])*r+a[4])*r+a[5])*q /
   (((((b[0]*r+b[1])*r+b[2])*r+b[3])*r+b[4])*r+1);
 }
}



Dain 2007-03-13 20:52 鍙戣〃璇勮
]]>
Quasi-Monte Carlo(Korobov rule)http://www.shnenglu.com/dqchen/articles/19618.htmlDainDainMon, 12 Mar 2007 03:04:00 GMThttp://www.shnenglu.com/dqchen/articles/19618.htmlhttp://www.shnenglu.com/dqchen/comments/19618.htmlhttp://www.shnenglu.com/dqchen/articles/19618.html#Feedback0http://www.shnenglu.com/dqchen/comments/commentRss/19618.htmlhttp://www.shnenglu.com/dqchen/services/trackbacks/19618.html#include  < cmath >
#include 
< vector >

using   namespace  std;

//  Korobov rules
vector <  vector < double >   >  korobov( int  a,  //  base 
                                                         int  n,  //  sample size(a prime) 
                                                         int  t)  //  dimensional
{
    vector
<double> G(t);
    vector
< vector<double> > U(n,vector<double>(t)); // t-dimensional points

    
int i,j;
    
for(i = 0;i < t;i++)
        G[i] 
= pow(a,i) / (double)n;

    
for(i = 0;i < n;i++)
        
for (j = 0;j < t;j++)
        {
            U[i][j] 
= fmod(i * G[j],1);
        }

    G.clear();

    
return U;
}


Dain 2007-03-12 11:04 鍙戣〃璇勮
]]>
久久久久国产精品麻豆AR影院 | 狠狠色婷婷久久一区二区| 国内精品久久久久国产盗摄| 亚洲国产成人久久综合一 | 久久久久亚洲AV成人片 | 久久久精品波多野结衣| 思思久久好好热精品国产| 少妇人妻综合久久中文字幕| 国内精品久久久久久99| 精品国产乱码久久久久久浪潮| 青青久久精品国产免费看| 久久无码人妻一区二区三区| 精品人妻伦一二三区久久| 亚洲国产精品无码久久久不卡| 久久精品一区二区三区不卡| 亚洲人成无码网站久久99热国产| 91精品国产91久久综合| 久久99热这里只频精品6| 成人午夜精品久久久久久久小说| 人妻无码精品久久亚瑟影视 | 亚洲精品97久久中文字幕无码| 久久久无码精品亚洲日韩京东传媒 | 久久综合狠狠色综合伊人| 国产精品美女久久久免费| 囯产极品美女高潮无套久久久| 国内精品久久久久久久97牛牛| 亚洲精品第一综合99久久| 久久综合久久久| 久久精品国产精品青草| 亚洲精品午夜国产VA久久成人| 深夜久久AAAAA级毛片免费看| 99久久精品免费看国产| 婷婷综合久久狠狠色99h| 久久99国内精品自在现线| 久久久久波多野结衣高潮| 久久综合鬼色88久久精品综合自在自线噜噜| 精品久久久久久| 99久久精品免费观看国产| 国产精品内射久久久久欢欢| 久久青青草原国产精品免费| 国产亚洲色婷婷久久99精品|