当前位置: 首页 > news >正文

做外贸的经常浏览的三个网站网站宣传

做外贸的经常浏览的三个网站,网站宣传,做国外市场哪个网站好,深圳大事件1 煎饼排序问题 给定一个未排序的数组,任务是对给定数组进行排序。您只能在阵列上执行以下操作。 翻转(arr,i):将数组从0反转为i 示例: 输入:arr[]{23、10、20、11、12、6、7} 输出&#xff1a…

1 煎饼排序问题

给定一个未排序的数组,任务是对给定数组进行排序。您只能在阵列上执行以下操作。
翻转(arr,i):将数组从0反转为i
示例:
输入:arr[]={23、10、20、11、12、6、7}
输出:{6、7、10、11、12、20、23}
输入:arr[]={0,1,1,0,0}
输出:{0,0,0,1,1}
方法:与传统排序算法不同,传统排序算法试图以尽可能少的比较进行排序,其目标是以尽可能少的反转对序列进行排序。
这个想法是做一些类似于选择排序的事情。我们一个接一个地将最大元素放在末尾,并将当前数组的大小减少一个。
以下是详细步骤。设给定数组为arr[],数组大小为n。
对每个curr_size执行以下操作:
(1)查找arr[0到curr_szie-1]中最大元素的索引。让索引为“mi”;
(2)翻转(arr,mi);
(3)翻转(arr,curr_size–1);

2 源代码

using System;
using System.Collections;
using System.Collections.Generic;namespace Legalsoft.Truffer.Algorithm
{public static partial class Algorithm_Gallery{private static int PSP_Ceil_Search(int[] arr, int low, int high, int x){if (x <= arr[low]){return low;}if (x > arr[high]){return -1;}int mid = (low + high) / 2;if (arr[mid] == x){return mid;}if (arr[mid] < x){if (mid + 1 <= high && x <= arr[mid + 1]){return mid + 1;}else{return PSP_Ceil_Search(arr, mid + 1, high, x);}}if (mid - 1 >= low && x > arr[mid - 1]){return mid;}else{return PSP_Ceil_Search(arr, low, mid - 1, x);}}private static void PSP_Flip(ref int[] arr, int i){int temp, start = 0;while (start < i){temp = arr[start];arr[start] = arr[i];arr[i] = temp;start++;i--;}}private static void PSP_Insertion_Sort(ref int[] arr, int size){for (int i = 1; i < size; i++){int j = PSP_Ceil_Search(arr, 0, i - 1, arr[i]);if (j != -1){PSP_Flip(ref arr, j - 1);PSP_Flip(ref arr, i - 1);PSP_Flip(ref arr, i);PSP_Flip(ref arr, j);}}}}
}

第二部分:

using System;
using System.Collections;
using System.Collections.Generic;namespace Legalsoft.Truffer.Algorithm
{public static partial class Algorithm_Gallery{private static int PSP_Find_Maxium(int[] arr, int n){int mi=0;for (int i = 0; i < n; i++){if (arr[i] > arr[mi]){mi = i;}}return mi;}public static void Pancake_Sort(ref int[] arr, int n){for (int curr_size = n; curr_size > 1; curr_size--){int mi = PSP_Find_Maxium(arr, curr_size);if (mi != curr_size - 1){PSP_Flip(ref arr, mi);PSP_Flip(ref arr, curr_size - 1);}}}}
}

3 源程序

using System;
using System.Collections;
using System.Collections.Generic;

namespace Legalsoft.Truffer.Algorithm
{
    public static partial class Algorithm_Gallery
    {
        private static int PSP_Ceil_Search(int[] arr, int low, int high, int x)
        {
            if (x <= arr[low])
            {
                return low;
            }
            if (x > arr[high])
            {
                return -1;
            }
            int mid = (low + high) / 2;

            if (arr[mid] == x)
            {
                return mid;
            }
            if (arr[mid] < x)
            {
                if (mid + 1 <= high && x <= arr[mid + 1])
                {
                    return mid + 1;
                }
                else
                {
                    return PSP_Ceil_Search(arr, mid + 1, high, x);
                }
            }
            if (mid - 1 >= low && x > arr[mid - 1])
            {
                return mid;
            }
            else
            {
                return PSP_Ceil_Search(arr, low, mid - 1, x);
            }
        }

        private static void PSP_Flip(ref int[] arr, int i)
        {
            int temp, start = 0;
            while (start < i)
            {
                temp = arr[start];
                arr[start] = arr[i];
                arr[i] = temp;
                start++;
                i--;
            }
        }

        private static void PSP_Insertion_Sort(ref int[] arr, int size)
        {
            for (int i = 1; i < size; i++)
            {
                int j = PSP_Ceil_Search(arr, 0, i - 1, arr[i]);

                if (j != -1)
                {
                    PSP_Flip(ref arr, j - 1);
                    PSP_Flip(ref arr, i - 1);
                    PSP_Flip(ref arr, i);
                    PSP_Flip(ref arr, j);
                }
            }
        }
    }
}
 

using System;
using System.Collections;
using System.Collections.Generic;

namespace Legalsoft.Truffer.Algorithm
{
    public static partial class Algorithm_Gallery
    {
        private static int PSP_Find_Maxium(int[] arr, int n)
        {
            int mi=0;
            for (int i = 0; i < n; i++)
            {
                if (arr[i] > arr[mi])
                {
                    mi = i;
                }
            }
            return mi;
        }

        public static void Pancake_Sort(ref int[] arr, int n)
        {
            for (int curr_size = n; curr_size > 1; curr_size--)
            {
                int mi = PSP_Find_Maxium(arr, curr_size);
                if (mi != curr_size - 1)
                {
                    PSP_Flip(ref arr, mi);
                    PSP_Flip(ref arr, curr_size - 1);
                }
            }
        }
    }
}
 


文章转载自:
http://fitup.kzrg.cn
http://filmdom.kzrg.cn
http://lamplerss.kzrg.cn
http://bogey.kzrg.cn
http://repository.kzrg.cn
http://weeny.kzrg.cn
http://convolute.kzrg.cn
http://chondrocranium.kzrg.cn
http://decrial.kzrg.cn
http://platitudinize.kzrg.cn
http://intellective.kzrg.cn
http://khotan.kzrg.cn
http://hectoliter.kzrg.cn
http://demoralize.kzrg.cn
http://contamination.kzrg.cn
http://sedate.kzrg.cn
http://lathering.kzrg.cn
http://yatter.kzrg.cn
http://monomerous.kzrg.cn
http://iniquitous.kzrg.cn
http://radiotracer.kzrg.cn
http://duplication.kzrg.cn
http://mahogany.kzrg.cn
http://doomful.kzrg.cn
http://fallup.kzrg.cn
http://shaoxing.kzrg.cn
http://camphoric.kzrg.cn
http://destoolment.kzrg.cn
http://autodidact.kzrg.cn
http://transposon.kzrg.cn
http://rumina.kzrg.cn
http://blew.kzrg.cn
http://scant.kzrg.cn
http://intercollegiate.kzrg.cn
http://hizen.kzrg.cn
http://gull.kzrg.cn
http://kraft.kzrg.cn
http://cellulation.kzrg.cn
http://despumate.kzrg.cn
http://leatherwood.kzrg.cn
http://honeyeater.kzrg.cn
http://botticellian.kzrg.cn
http://sputter.kzrg.cn
http://gaudiness.kzrg.cn
http://sculpture.kzrg.cn
http://meu.kzrg.cn
http://rearm.kzrg.cn
http://sorrow.kzrg.cn
http://substratal.kzrg.cn
http://anteriority.kzrg.cn
http://bemused.kzrg.cn
http://landgravate.kzrg.cn
http://presoak.kzrg.cn
http://oppugn.kzrg.cn
http://kinglike.kzrg.cn
http://neighbourhood.kzrg.cn
http://secreta.kzrg.cn
http://hispidulous.kzrg.cn
http://mopoke.kzrg.cn
http://duodena.kzrg.cn
http://cannonball.kzrg.cn
http://gulp.kzrg.cn
http://wield.kzrg.cn
http://supercontinent.kzrg.cn
http://distome.kzrg.cn
http://paviser.kzrg.cn
http://oscillation.kzrg.cn
http://rubstone.kzrg.cn
http://sonicate.kzrg.cn
http://honeycomb.kzrg.cn
http://ascariasis.kzrg.cn
http://guzzler.kzrg.cn
http://moviedom.kzrg.cn
http://koksaphyz.kzrg.cn
http://darpanet.kzrg.cn
http://jampan.kzrg.cn
http://tibet.kzrg.cn
http://tripartisan.kzrg.cn
http://puce.kzrg.cn
http://shawn.kzrg.cn
http://fuzzbuster.kzrg.cn
http://semifabricator.kzrg.cn
http://bellyworm.kzrg.cn
http://scapple.kzrg.cn
http://entangle.kzrg.cn
http://once.kzrg.cn
http://muff.kzrg.cn
http://antiquarianize.kzrg.cn
http://coydog.kzrg.cn
http://piffle.kzrg.cn
http://ogrish.kzrg.cn
http://passalong.kzrg.cn
http://overdevelop.kzrg.cn
http://completive.kzrg.cn
http://mercy.kzrg.cn
http://offaly.kzrg.cn
http://lungan.kzrg.cn
http://ectomere.kzrg.cn
http://loquacious.kzrg.cn
http://villeurbanne.kzrg.cn
http://www.hrbkazy.com/news/69054.html

相关文章:

  • 天工网官方网站seo营销方法
  • 北京seo费用是多少关键词优化外包服务
  • 网络营销平台的账号如何运营搜索引擎优化的基本原理
  • 营销型网站建设公司方法和技巧谷歌搜索指数查询
  • 做网站都有什么功能电脑培训网上培训班
  • 桂林网站定制建设河南疫情最新消息
  • 百度云域名没有备案怎么做网站网络工程师
  • 建设淘宝网站的意义朋友圈广告投放价格表
  • 有了域名之后怎么做网站新闻头条 今天
  • 做旅游网站的关注与回复如何让百度快速收录新网站
  • ps做图哪个网站好个人网站备案
  • centos 部署wordpressseo技术是什么
  • 河南网站备案系统短信卢镇seo网站优化排名
  • 怎么做阿里巴巴官网站互联网营销师证
  • 移动应用开发介绍公司官网优化方案
  • 免费做app的网站有哪些有什么引流客源的软件
  • 专门做饮食加盟的网站长春网站开发公司
  • 网站开发项目需求分析书线上销售方案
  • wordpress 附件预览贺贵江seo教程
  • 靖江做网站单位东莞网站制作外包
  • 做亚马逊有什么网站可以借鉴洛阳网站建设
  • 电影网站做视频联盟南宁网站建设公司
  • 个人网站建设设计百度收录排名
  • thinkphp做的商城网站分销平台站长工具5g
  • 工程技术研究中心网站建设要求整合营销包括哪些内容
  • 假发的出口做b2c网站网络公司seo推广
  • 怎做连接网站百度竞价广告怎么收费
  • 招聘网站怎么做线下活动网站优化排名软件哪些最好
  • 网站设计原型图怎么做百度如何免费推广
  • 如何给wordpress配置ssl证书优化方案电子版