排序算法中平均时间复杂度

作业排序 (Job sequencing)

Job sequencing is the set of jobs, associated with the job i where deadline di >= 0 and profit pi > 0. For any job i the profit is earned if and only if the job is completed by its deadline. To complete a job, one has to process the job on a machine for one unit of time. Only one machine is available for processing the jobs.

作业排序是与作业i相关联的一组作业,其中期限di> = 0且利润pi> 0 。 对于任何工作, 我当且仅当作业被其限期完成利润赚。 为了完成一项工作,必须在一台机器上在一个单位时间内处理该工作。 仅一台机器可用于处理作业。

Steps for performing job sequencing with deadline using greedy approach is as follows:

使用贪婪方法在截止日期之前执行作业排序的步骤如下:

  1. Sort all the jobs based on the profit in an increasing order.

    根据利润按升序对所有作业进行排序。

  2. Let α be the maximum deadline that will define the size of array.

    令α为将定义数组大小的最大截止日期。

  3. Create a solution array S with d slots.

    创建具有d个插槽的解决方案数组S。

  4. Initialize the content of array S with zero.

    用零初始化数组S的内容。

  5. Check for all jobs.

    检查所有作业。

    1. If scheduling is possible a lot ith slot of array s to job i.
    2. 如果调度是可能很多我阵列的时隙s到工作我 。
    3. Otherwise look for location (i-1), (i-2)...1.
    4. 否则寻找位置(i-1),(i-2)... 1 。
    5. Schedule the job if possible else reject.
  6. Return array S as the answer.

    返回数组S作为答案。

  7. End.

    结束。

作业排序算法 (Algorithm for job sequencing)

Input: A is the array of jobs with deadline and profit S array will be the output.

输入: A是具有截止日期的职位数组,而利润S数组将是输出。

    1. Begin
2. Sort all the jobs based on profit Pi so
3. P1 > P2 > P3 …………………………….>=Pn
4. d = maximum deadline of job in A
5. Create array S[1,…………………,d]
6. For i=1 to n do
7. Find the largest job x
8. For j=i to 1
9. If ((S[j] = 0) and (x deadline<= d))
10. Then
11. S[x] = i;
12. Break;
13. End if
14. End for
15. End for
16. End

时间复杂度 (Time complexity)

Job sequencing problems has the time complexity of O(n2).

作业排序问题的时间复杂度为O(n2)。

Example:

例:

Given a set of 9 jobs where each job has a deadline and profit associated to it .Each job takes 1 unit of time to complete and only one job can be scheduled at a time. We earn the profit if and only if the job is completed by its deadline. The task is to find the maximum profit and the number of jobs done.

给定一组9个工作,每个工作都有一个截止日期和与之相关的利润。每个工作需要1个时间单位才能完成,并且一次只能安排一个工作。 当且仅当工作在截止日期之前完成时,我们才能赚取利润。 任务是找到最大的利润和完成的工作数量。

    Jobs     Profit   Deadline
J1          85          5
J2          25          4
J3          16          3
J4          40          3
J5          55          4
J6          19          5
J7          92          2
J8          80          3
J9          15          7
.minHeight{ min-height: 250px; } @media (min-width: 1025px){ .minHeight{ min-height: 90px; } } .minHeight{ min-height: 250px; } @media (min-width: 1025px){ .minHeight{ min-height: 90px; } }

Step 1:

第1步:

Step 2:

第2步:

Step 3:

第三步:

Step 4:

第4步:

Step 5:

步骤5:

Step 6:

步骤6:

So, the maximum profit = 40 + 92 + 80 + 55 + 85 + 15 = 367

因此,最大利润= 40 + 92 + 80 + 55 + 85 + 15 = 367

翻译自: https://www.includehelp.com/operating-systems/job-sequencing.aspx

排序算法中平均时间复杂度

排序算法中平均时间复杂度_操作系统中的作业排序(算法,时间复杂度和示例)...相关推荐

  1. 操作系统中的死锁_操作系统中的死锁介绍

    操作系统中的死锁 1.1究竟什么是僵局? (1.1 What exactly is a deadlock?) In a multiprogramming environment, there may ...

  2. python中的排序方法都有哪些_几种常见的排序方法总结(Python)

    几种常见的排序算法总结(Python) 排序算法:是一种能将一串数据依照特定顺序进行排序的一种算法. 稳定性:稳定排序算法会让原本有相等键值的记录维持相对次序.也就是如果一个排序算法是稳定的,当有两个 ...

  3. des算法密码多长_密码学中的多个DES

    des算法密码多长 This is a DES that was susceptible to attacks due to tremendous advances in computer hardw ...

  4. 操作系统 系统开销比率_操作系统中的最高响应比率下一个(HRRN)调度

    操作系统 系统开销比率 操作系统中的HRRN调度是什么? (What is HRRN Scheduling in Operating System?) HRRN is the abbreviation ...

  5. python 文件管理系统为用户_操作系统中的文件管理系统为用户提供的功能是什么...

    操作系统中的文件管理系统为用户提供的功能是按文件名管理文件,文件管理主要负责文件的存储.检索.共享和保护,为用户提供文件操作的方便. 操作系统中的文件管理系统为4 D R Y W 5用户提供的功能是按 ...

  6. 操作系统大内核和微内核_操作系统中的内核

    操作系统大内核和微内核 A Kernel is the central component of an Operating System. The Kernel is also said to be ...

  7. 操作系统中的处理机调度调度_操作系统中的流程分类和调度

    操作系统中的处理机调度调度 处理 (Process) In the operating system, there are numerous task and application program ...

  8. 关于细分到字段的权限系统_操作系统中的细分

    关于细分到字段的权限系统 为什么需要细分? (Why Segmentation is required?) In the Operating System, an important drawback ...

  9. 操作系统文件分配策略_操作系统中的文件分配方法

    操作系统文件分配策略 分配方法 (Allocation Method) The allocation method defines how the files are stored in the di ...

最新文章

  1. Android 6.0 权限管理最佳实践
  2. 深度前沿:对话管理模型研究最新进展
  3. [Leedcode][JAVA][第14题][最长公共前缀][二分][横竖扫描][分治]
  4. java语法格式整理
  5. python字符串常用函数-Python字符串常用函数详解
  6. Vue3 配置代理和使用全局axios请求数据
  7. Android 匿名共享内存驱动源码分析
  8. Crossoft Minesweeper Hexagon for Mac
  9. 【visio 绘图矢量图素材网站】
  10. Q 语言初学者系列:(3)Lists 初级
  11. RAC环境的AFD详解
  12. 使用Selenium爬取淘宝商品
  13. 【撸大湿】Storm 分布式BP神经网络(开源)
  14. mx450属于什么档次的显卡
  15. mars3d-热力图
  16. Unity之使物体透明化和还原
  17. SQL 四大功能DDL/DML/DCL/TCL
  18. python切片是什么意思_python中的切片是什么?(实例解析)
  19. 树莓派3B+、opencv3+PyQt5实现人脸识别门禁系统
  20. PageHelper 分页的实例

热门文章

  1. 为input输入框添加圆角并去除阴影
  2. css类选择器类名覆盖优先级
  3. HTML5与CSS3权威指南笔记案例1
  4. PHP中常用加解密方式
  5. IdnentiyServer-使用客户端凭据访问API
  6. Hexo之部署github
  7. 圆形坠落模拟算法设计
  8. python 文件遍历
  9. 服务器角色与数据库角色
  10. linux操作系统好吗_国内可以通过安卓+termux打造出适用手机平板和电脑全平台最好的操作系统...