亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? qsort_int.cc

?? sparselib庫
?? CC
字號:
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*//*             ********   ***                                 SparseLib++    *//*          *******  **  ***       ***      ***                              *//*           *****      ***     ******** ********                            *//*            *****    ***     ******** ********              R. Pozo        *//*       **  *******  ***   **   ***      ***                 K. Remington   *//*        ********   ********                                 A. Lumsdaine   *//*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*//*                                                                           *//*                                                                           *//*                     SparseLib++ : Sparse Matrix Library                   *//*                                                                           *//*               National Institute of Standards and Technology              *//*                        University of Notre Dame                           *//*              Authors: R. Pozo, K. Remington, A. Lumsdaine                 *//*                                                                           *//*                                 NOTICE                                    *//*                                                                           *//* Permission to use, copy, modify, and distribute this software and         *//* its documentation for any purpose and without fee is hereby granted       *//* provided that the above notice appear in all copies and supporting        *//* documentation.                                                            *//*                                                                           *//* Neither the Institutions (National Institute of Standards and Technology, *//* University of Notre Dame) nor the Authors make any representations about  *//* the suitability of this software for any purpose.  This software is       *//* provided ``as is'' without expressed or implied warranty.                 *//*                                                                           *//*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/// An adaptation of Schmidt's new quicksort (taken from GNU emacs)// for MV++// by Andrew Lumsdaine#include "qsort_int.h"#ifdef sparc#include <alloca.h>#endif// Invoke the < comparison function#define CMP(A,B) ((A) < (B))// swap two items//static inline void SWAP_int(int &A, int &B){    int tmp = A; A = B; B = tmp;} static inline void swap_int(int &a, int &b){    int tmp=a; a=b; b=tmp;}// This should be replaced by a standard ANSI macro.#define BYTES_PER_WORD 8/* The next 4 #defines implement a very fast in-line stack abstraction. */#define STACK_SIZE (BYTES_PER_WORD * sizeof (long))#define PUSH(LOW,HIGH) do {top->lo = LOW;top++->hi = HIGH;} while (0)#define POP(LOW,HIGH)  do {LOW = (--top)->lo;HIGH = top->hi;} while (0)#define STACK_NOT_EMPTY (stack < top)                /* Discontinue quicksort algorithm when partition gets below this size.   This particular magic number was chosen to work best on a Sun 4/260. */#define MAX_THRESH 4/* Stack node declarations used to store unfulfilled partition obligations. */typedef struct {  int lo;  int hi;} stack_node;/* Order size using quicksort.  This implementation incorporates   four optimizations discussed in Sedgewick:      1. Non-recursive, using an explicit stack of pointer that store the       next array partition to sort.  To save time, this maximum amount       of space required to store an array of MAX_INT is allocated on the       stack.  Assuming a 32-bit integer, this needs only 32 *       sizeof (stack_node) == 136 bits.  Pretty cheap, actually.   2. Chose the pivot element using a median-of-three decision tree.      This reduces the probability of selecting a bad pivot value and       eliminates certain extraneous comparisons.   3. Only quicksorts TOTAL_ELEMS / MAX_THRESH partitions, leaving      insertion sort to order the MAX_THRESH items within each partition.        This is a big win, since insertion sort is faster for small, mostly      sorted array segments.      4. The larger of the two sub-partitions is always pushed onto the      stack first, with the algorithm then concentrating on the      smaller partition.  This *guarantees* no more than log (n)      stack size is needed (actually O(1) in this case)! */      int QSort(VECTOR_int& v, int base_ptr, int total_elems){  int pivot_buffer;    if (total_elems > MAX_THRESH) {        int lo = base_ptr;    int hi = lo + total_elems - 1;        stack_node stack[STACK_SIZE]; /* Largest size needed for 32-bit int!!! */    stack_node *top = stack + 1;        while (STACK_NOT_EMPTY) {      int left_ptr;      int right_ptr;      {    {      /* Select median value from among LO, MID, and HI. Rearrange         LO and HI so the three values are sorted. This lowers the          probability of picking a pathological pivot value and          skips a comparison for both the LEFT_PTR and RIGHT_PTR. */            int mid = lo + (hi - lo) / 2;            if (CMP (v[mid], v[lo]))        SWAP_int(v[mid], v[lo]);      if (CMP (v[hi], v[mid]))        SWAP_int(v[hi], v[mid]);      else         goto jump_over;            if (CMP (v[mid], v[lo]))        SWAP_int(v[mid], v[lo]);          jump_over:      pivot_buffer = v[mid];    }        left_ptr  = lo + 1;    right_ptr = hi - 1;        /* Here's the famous ``collapse the walls'' section of quicksort.         Gotta like those tight inner loops!  They are the main reason        that this algorithm runs much faster than others. */    do {      while (CMP (v[left_ptr], pivot_buffer))        left_ptr++;            while (CMP (pivot_buffer, v[right_ptr]))        right_ptr--;            if (left_ptr < right_ptr) {        SWAP_int(v[left_ptr], v[right_ptr]);        left_ptr++;        right_ptr--;      } else if (left_ptr == right_ptr) {        left_ptr ++;        right_ptr --;        break;      }    } while (left_ptr <= right_ptr);      }            /* Set up pointers for next iteration.  First determine whether     left and right partitions are below the threshold size. If so,      ignore one or both.  Otherwise, push the larger partition's     bounds on the stack and continue sorting the smaller one. */            if ((right_ptr - lo) <= MAX_THRESH) {    if ((hi - left_ptr) <= MAX_THRESH)      POP (lo, hi);     else      lo = left_ptr;      } else if ((hi - left_ptr) <= MAX_THRESH)    hi = right_ptr;      else if ((right_ptr - lo) > (hi - left_ptr)) {                       PUSH (lo, right_ptr);    lo = left_ptr;      } else {                       PUSH (left_ptr, hi);    hi = right_ptr;      }    }  }    /* Once the BASE_PTR array is partially sorted by quicksort the rest     is completely sorted using insertion sort, since this is efficient      for partitions below MAX_THRESH size. BASE_PTR points to the beginning      of the array to sort, and END_PTR points at the very last element in     the array (*not* one beyond it!). */  #define MIN(X,Y) ((X) < (Y) ? (X) : (Y))  {    int end_ptr = base_ptr + total_elems - 1;    int run_ptr;    int tmp_ptr = base_ptr;    int thresh = MIN (end_ptr, base_ptr + MAX_THRESH);        for (run_ptr = tmp_ptr + 1; run_ptr <= thresh; run_ptr++)      if (CMP (v[run_ptr], v[tmp_ptr]))    tmp_ptr = run_ptr;        if (tmp_ptr != base_ptr)      SWAP_int(v[tmp_ptr], v[base_ptr]);        for (run_ptr = base_ptr + 1; (tmp_ptr = run_ptr += 1) <= end_ptr;) {            while (CMP (v[run_ptr], v[tmp_ptr -= 1]))    ;            if ((tmp_ptr += 1) != run_ptr) {    int trav;        for (trav = run_ptr + 1; --trav >= run_ptr;) {      int c;      c = v[trav];      int hi, lo;            for (hi = lo = trav; (lo -= 1) >= tmp_ptr; hi = lo)        v[hi] = v[lo];      v[hi] = c;    }      }    }  }  return 1;}int QSort(VECTOR_int & v, VECTOR_int& x, int base_ptr, int total_elems){  int pivot_buffer;  int pixot_buffer;    if (total_elems > MAX_THRESH) {        int lo = base_ptr;    int hi = lo + total_elems - 1;        stack_node stack[STACK_SIZE]; /* Largest size needed for 32-bit int!!! */    stack_node *top = stack + 1;        while (STACK_NOT_EMPTY) {      int left_ptr;      int right_ptr;      {    {      /* Select median value from among LO, MID, and HI. Rearrange         LO and HI so the three values are sorted. This lowers the          probability of picking a pathological pivot value and          skips a comparison for both the LEFT_PTR and RIGHT_PTR. */            int mid = lo + (hi - lo) / 2;            if (CMP (v[mid], v[lo])) {        swap_int (v[mid], v[lo]);        SWAP_int (x[mid], x[lo]);      }      if (CMP (v[hi], v[mid])) {        swap_int (v[hi], v[mid]);        SWAP_int (x[hi], x[mid]);      } else         goto jump_over;            if (CMP (v[mid], v[lo])) {        swap_int(v[mid], v[lo]);        SWAP_int (x[mid], x[lo]);      }          jump_over:      pivot_buffer = v[mid];      pixot_buffer = x[mid];    }        left_ptr  = lo + 1;    right_ptr = hi - 1;        /* Here's the famous ``collapse the walls'' section of quicksort.         Gotta like those tight inner loops!  They are the main reason        that this algorithm runs much faster than others. */    do {      while (CMP (v[left_ptr], pivot_buffer))        left_ptr++;            while (CMP (pivot_buffer, v[right_ptr]))        right_ptr--;            if (left_ptr < right_ptr) {        swap_int (v[left_ptr], v[right_ptr]);        SWAP_int (x[left_ptr], x[right_ptr]);        left_ptr++;        right_ptr--;      } else if (left_ptr == right_ptr) {        left_ptr ++;        right_ptr --;        break;      }    } while (left_ptr <= right_ptr);      }            /* Set up pointers for next iteration.  First determine whether     left and right partitions are below the threshold size. If so,      ignore one or both.  Otherwise, push the larger partition's     bounds on the stack and continue sorting the smaller one. */            if ((right_ptr - lo) <= MAX_THRESH) {    if ((hi - left_ptr) <= MAX_THRESH)      POP (lo, hi);     else      lo = left_ptr;      } else if ((hi - left_ptr) <= MAX_THRESH)    hi = right_ptr;      else if ((right_ptr - lo) > (hi - left_ptr)) {                       PUSH (lo, right_ptr);    lo = left_ptr;      } else {                       PUSH (left_ptr, hi);    hi = right_ptr;      }    }  }    /* Once the BASE_PTR array is partially sorted by quicksort the rest     is completely sorted using insertion sort, since this is efficient      for partitions below MAX_THRESH size. BASE_PTR points to the beginning      of the array to sort, and END_PTR points at the very last element in     the array (*not* one beyond it!). */  #define MIN(X,Y) ((X) < (Y) ? (X) : (Y))  {    int end_ptr = base_ptr + total_elems - 1;    int run_ptr;    int tmp_ptr = base_ptr;    int thresh = MIN (end_ptr, base_ptr + MAX_THRESH);        for (run_ptr = tmp_ptr + 1; run_ptr <= thresh; run_ptr++)      if (CMP (v[run_ptr], v[tmp_ptr]))    tmp_ptr = run_ptr;        if (tmp_ptr != base_ptr) {      swap_int(v[tmp_ptr], v[base_ptr]);      SWAP_int (x[tmp_ptr], x[base_ptr]);    }        for (run_ptr = base_ptr + 1; (tmp_ptr = run_ptr += 1) <= end_ptr;) {            while (CMP (v[run_ptr], v[tmp_ptr -= 1]))    ;            if ((tmp_ptr += 1) != run_ptr) {    int trav;        for (trav = run_ptr + 1; --trav >= run_ptr;) {      int  c;      int d;      c = v[trav];      d = x[trav];      int hi, lo;            for (hi = lo = trav; (lo -= 1) >= tmp_ptr; hi = lo) {        v[hi] = v[lo];        x[hi] = x[lo];      }      v[hi] = c;      x[hi] = d;    }      }    }  }  return 1;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区视频在线观看2022| 国产成人午夜视频| 日韩免费电影网站| 欧美精品丝袜中出| 欧美人伦禁忌dvd放荡欲情| 色狠狠色狠狠综合| 欧美在线不卡视频| 欧美日韩在线一区二区| 欧美精品久久一区二区三区| 欧美人体做爰大胆视频| 日韩欧美一区电影| 中文字幕 久热精品 视频在线 | av在线不卡免费看| 国产成人在线看| 成人黄色在线网站| 色视频欧美一区二区三区| 欧美在线|欧美| 日韩欧美三级在线| 国产精品亲子乱子伦xxxx裸| 亚洲免费高清视频在线| 手机精品视频在线观看| 久久99国产乱子伦精品免费| 国产69精品一区二区亚洲孕妇| 亚洲国产cao| 美女性感视频久久| 国产激情偷乱视频一区二区三区| 亚洲视频免费观看| 日韩精品免费专区| 国产盗摄一区二区三区| 色婷婷精品久久二区二区蜜臂av| 九一久久久久久| av电影在线观看不卡| 欧美日韩成人在线| 国产精品污网站| 免费av网站大全久久| 春色校园综合激情亚洲| 欧美日韩亚洲高清一区二区| 久久婷婷色综合| 亚洲一区二区精品久久av| 老司机午夜精品99久久| 色婷婷久久99综合精品jk白丝| 国产69精品久久777的优势| 欧美色倩网站大全免费| 中文字幕在线观看一区二区| 亚洲小说春色综合另类电影| 国产成人8x视频一区二区| 7799精品视频| 亚洲精品国产一区二区精华液| 亚洲视频综合在线| 奇米四色…亚洲| 日本大香伊一区二区三区| 国产亚洲一区二区三区在线观看 | 欧美日韩性生活| 国产欧美一区二区三区在线看蜜臀| 欧美成人艳星乳罩| 一二三四区精品视频| 精品亚洲成a人| 欧美日本国产视频| 亚洲第一精品在线| 欧美色精品天天在线观看视频| 欧美色中文字幕| 亚洲精品国产第一综合99久久 | 日韩av在线播放中文字幕| 不卡一区在线观看| 国产欧美精品一区二区色综合朱莉| 久久综合九色综合97婷婷女人| 欧美成va人片在线观看| 午夜欧美电影在线观看| 91美女片黄在线观看| 欧美国产精品专区| 精品一区二区三区在线播放| 在线播放一区二区三区| 亚洲一区二区高清| 欧美色网一区二区| 亚洲国产综合视频在线观看| 欧美性一二三区| 亚洲第一狼人社区| 4438x成人网最大色成网站| 亚洲成人av中文| 日韩一区二区三区视频在线| 美国十次了思思久久精品导航| 国产精品一区二区91| 国产欧美日韩视频一区二区 | 欧美一区二区成人| 久久国产生活片100| 久久精品免费在线观看| 不卡电影一区二区三区| 亚洲人一二三区| 欧美亚洲一区二区在线观看| 婷婷六月综合网| 26uuu久久综合| 成人av在线播放网站| 1024成人网色www| 欧美综合视频在线观看| 男男gaygay亚洲| 国产精品日产欧美久久久久| 国产传媒久久文化传媒| 亚洲日本在线a| 91精品国产91久久久久久一区二区| 久久久午夜精品理论片中文字幕| 亚洲三级在线免费观看| 欧美日韩亚洲综合一区二区三区| 国产亚洲欧美日韩日本| 91免费国产视频网站| 爽好久久久欧美精品| 欧美本精品男人aⅴ天堂| 成人黄色在线网站| 日韩高清国产一区在线| 国产精品色哟哟| 6080午夜不卡| av电影一区二区| 欧美bbbbb| 综合中文字幕亚洲| 精品国内二区三区| 欧美综合在线视频| 成人中文字幕电影| 奇米色777欧美一区二区| 最近日韩中文字幕| 久久精品一区二区三区四区| 欧美日韩一区二区欧美激情| 成人在线一区二区三区| 久久国产日韩欧美精品| 亚洲欧美日韩电影| 欧美激情一区三区| 精品国产一区a| 91麻豆精品国产91久久久久久久久 | 午夜视频一区在线观看| 国产欧美日韩在线看| 日韩一级完整毛片| 欧美三级欧美一级| 成人性生交大片| 国产精品一区二区果冻传媒| 亚洲自拍偷拍网站| 亚洲私人黄色宅男| 国产精品蜜臀av| 国产蜜臀97一区二区三区| 欧美一级二级三级乱码| 欧美日韩国产综合一区二区| 欧美中文字幕不卡| 一本久久精品一区二区| av激情综合网| 97se亚洲国产综合自在线不卡 | 欧美日韩精品一区二区三区四区 | av午夜精品一区二区三区| 日本女优在线视频一区二区| 亚洲一二三四在线| 亚洲日本va午夜在线影院| 日本一区二区成人| 久久午夜免费电影| 国产欧美一二三区| 中文成人综合网| 亚洲国产精品v| 亚洲欧洲国产日韩| 中文字幕在线观看一区| 亚洲男同1069视频| 夜夜嗨av一区二区三区四季av| 91精品国产综合久久精品性色| 日韩av一区二区三区四区| 调教+趴+乳夹+国产+精品| 天天av天天翘天天综合网色鬼国产| 欧美不卡视频一区| 欧美电视剧在线看免费| 久久人人97超碰com| 欧美国产精品专区| 亚洲精品高清在线观看| 亚洲国产一区二区三区| 裸体一区二区三区| 国产成人精品亚洲午夜麻豆| 成人av电影在线| 欧美伊人久久大香线蕉综合69 | 91麻豆精品国产91久久久久久久久| 狠狠v欧美v日韩v亚洲ⅴ| 国产成人精品网址| 色综合久久久久综合| 欧美日韩在线播放三区| 日韩久久久精品| 国产精品丝袜久久久久久app| 欧美日韩久久一区二区| 日韩精品在线看片z| 综合婷婷亚洲小说| 奇米影视一区二区三区| av网站一区二区三区| 欧美日韩性生活| 国产精品污网站| 奇米亚洲午夜久久精品| 成人美女在线观看| 欧美一区二区大片| 亚洲男人电影天堂| 国产一区二区三区久久久 | 日韩一区二区在线看| 国产女主播一区| 一区二区在线观看视频| 久久国产人妖系列| 91福利资源站| 国产亚洲va综合人人澡精品| 一区二区三区日韩在线观看| 九九国产精品视频| 欧美视频一区二区三区四区| 国产精品久久久久一区二区三区| 久久男人中文字幕资源站|