Skip to content

Problem solving: minimum average waiting time algorythm

Notifications You must be signed in to change notification settings

zx80live/min-avg-time

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minimum Average Waiting Time

Version 1.0

Requirements

  • Scala: 2.11.8
  • JRE: 8

Usage

1) Clone repo:

git clone https://github.com/zx80live/min-avg-time

2) Change directory:

cd ./min-avg-time

3) Set file permissions:

chmod 774 ./bin/*

4) Run application:

./bin/activator "runMain com.zx80live.avg.AvgSolverApp"

5) Enter first parameter N within prompt, press Enter, and enter second list of parameters Ti Li delimited by Enter. After that the program will print the min avg time for the entered list. See below screenshot for example.

picture tag

Algorithm descriptions

A = 5,3 [8 ] [2 ]      (3 )
B = 0,4 [4 ] [-4]      (12)  => 8.333
C = 7,5 [12] [2 ]      (10)


                              C   .   .   .   .   .---*---*---*---*---R        

  B   .   .   .   .   .   .   .   .---*---*---*---R
  
                      A---*---*---R
   
__|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|____
  0   1   2   3   4   5   6   7   8   9   10  11  12  13  14  15  16  17  18  19  20  21
  

B = 0,4 [4 ] [-4]      (4)
A = 5,3 [8 ] [2 ]      (3) => 4.333
C = 7,5 [12] [2 ]      (6)


                              C   .---*---*---*---*---R
  
                      A---*---*---R
  B---*---*---*---R
   
__|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|____
  0   1   2   3   4   5   6   7   8   9   10  11  12  13  14  15  16  17  18  19  20  21  
  
  
  
  
  
  
  
  
  
B = 0,4 [4 ] [-4]      (4)
C = 7,5 [12] [2 ]      (5)
A = 5,3 [8 ] [2 ]      10) => 6.333



                      A   .   .   .   .   .   .   .---*---*---R
                              
                              C---*---*---*---*---R
  
  B---*---*---*---R
   
__|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|____
  0   1   2   3   4   5   6   7   8   9   10  11  12  13  14  15  16  17  18  19  20  21    
  
  
  
  
  
  
  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A = 0,3 [3 ] [-3]  (3 )
B = 1,9 [10] [-8]  (11) => 10
C = 2,6 [8 ] [-4]  (16)


          C   .   .   .   .   .   .   .   .   .   .---*---*---*---*---*---R
           
      B   .   .---*---*---*---*---*---*---*---*---R       
      
  A---*---*---R
  
__|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|____
  0   1   2   3   4   5   6   7   8   9   10  11  12  13  14  15  16  17  18  19  20  21

  
  
A = 0,3 [3 ] [-3]  (3 )
C = 2,6 [8 ] [-4]  (7 ) => 9
B = 1,9 [10] [-8]  (17)


      B   .   .   .   .   .   .   .   .---*---*---*---*---*---*---*---*---R       
      
          C   .---*---*---*---*---*---R
      
  A---*---*---R
  
__|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|____
  0   1   2   3   4   5   6   7   8   9   10  11  12  13  14  15  16  17  18  19  20  21
    
    
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

A = 0,3  [3 ] [-3]  (3)
B = 5,3  [8 ] [2 ]  (3) => 3
C = 10,3 [13] [7 ]  (3)

                                          C---*---*---R
     
                      B---*---*---R
  A---*---*---R

__|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|____
  0   1   2   3   4   5   6   7   8   9   10  11  12  13  14  15  16  17  18  19  20  21

  

A = 0,3  [3 ] [-3]  (3)
C = 10,3 [13] [7 ]  (3)
B = 5,3  [8 ] [2 ]  (8)


                                          C---*---*---R
     
                      B   .   .   .   .   .   .   .   .---*---*---R
  A---*---*---R

__|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|____
  0   1   2   3   4   5   6   7   8   9   10  11  12  13  14  15  16  17  18  19  20  21

  
C = 10,3 [13] [7 ]  ()
A = 0,3  [3 ] [-3]  ()
B = 5,3  [8 ] [2 ]  ()



     
                      B   .   .   .   .   .   .   .   .   .   .   .---*---*---R
                      
  A   .   .   .   .   .   .   .   .   .   .   .   .   .---*---*---R

                                          C---*---*---R
                                          
__|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|___|____
  0   1   2   3   4   5   6   7   8   9   10  11  12  13  14  15  16  17  18  19  20  21
  

About

Problem solving: minimum average waiting time algorythm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages