日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > windows >内容正文

windows

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

發布時間:2023/12/1 windows 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 排序算法中平均时间复杂度_操作系统中的作业排序(算法,时间复杂度和示例)... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

排序算法中平均時間復雜度

作業排序 (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:

使用貪婪方法在截止日期之前執行作業排序的步驟如下:

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

    根據利潤按升序對所有作業進行排序。

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

    令α為將定義數組大小的最大截止日期。

  • Create a solution array S with d slots.

    創建具有d個插槽的解決方案數組S。

  • Initialize the content of array S with zero.

    用零初始化數組S的內容。

  • Check for all jobs.

    檢查所有作業。

  • If scheduling is possible a lot ith slot of array s to job i.
  • 如果調度是可能很多我陣列的時隙s到工作我 。
  • Otherwise look for location (i-1), (i-2)...1.
  • 否則尋找位置(i-1),(i-2)... 1 。
  • Schedule the job if possible else reject.
  • Return array S as the answer.

    返回數組S作為答案。

  • 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. Begin2. Sort all the jobs based on profit Pi so3. P1 > P2 > P3 …………………………….>=Pn4. d = maximum deadline of job in A5. Create array S[1,…………………,d]6. For i=1 to n do7. Find the largest job x8. For j=i to 19. If ((S[j] = 0) and (x deadline<= d))10. Then 11. S[x] = i;12. Break;13. End if14. End for15. End for16. 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 DeadlineJ1 85 5J2 25 4J3 16 3J4 40 3J5 55 4J6 19 5J7 92 2J8 80 3J9 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

    排序算法中平均時間復雜度

    總結

    以上是生活随笔為你收集整理的排序算法中平均时间复杂度_操作系统中的作业排序(算法,时间复杂度和示例)...的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。