Create a scheduling algorithm for a central SQL server that responds to database queries from many different clients. The queries can only be run one at a time, but can be run in any order. We know in advance what the queries are and what their running times will be.

We want to choose how to schedule query such that the overall waiting time is minimized. The *waiting time* of a query is how long it must wait in a queue before it is executed.

For example, if the running times of the queries are (2, 5, 1, 3) and we schedule the queries in that order, then the total waiting time is 0 + (2) + (2+5) + (2+5+1) = 17. If we scheduled them in the reverse order, then the total waiting time is 0 + (3) + (1+3) + (5+1+3) = 16, which is slightly better. However, the minimum possible waiting time for this example is 10.

Implement the function scheduling(times), which is given a list of query times and returns the optimal (minimum) total waiting time.


scheduling([2, 5, 1, 3]) # 10

scheduling([3, 4, 4, 4, 4, 2]) # 46

scheduling([3, 1, 4, 3]) # 12

scheduling([7, 3, 7, 3, 3, 1]) # 39

scheduling([2, 6, 2, 6, 3, 6]) # 45

And use this to start the code:

def scheduling(times):


Compétences : SQL, Serveur SQL Microsoft, Programmation de bases de données, Python, Algorithme

en voir plus : create animation for a company logo, create animation for a video production, create app for my website, create application for external domain registrar, create design for products, create designs for equipment labels, create illustration for trial subscription page, create label for new engine, create logo for band, create logo for ccg, create logo for company, create logo for our new family of services - webzilla apps!, create logo for our new family of services webzilla apps, create logo for private brand, create logo for prodigit, create logo for small construction company, create logo for uka, create logo for website, create logo for wood and create, create mockups for energy

Concernant l'employeur :
( 2 commentaires ) mankato, United States

Nº du projet : #22727340

Décerné à:


Hi, Nice to meet you! I have read your requirements carefully and I am very interesting for your project. I am confident of this project as I'm a professional Python expert with over 5 years of experience. [login to view URL] Plus

%selectedBids___i_sum_sub_7% %project_currencyDetails_sign_sub_8% USD en 7 jours
(39 Commentaires)

11 freelance font une offre moyenne de $69 pour ce travail


Hello, this is a kind of optimization task. It will require to test all (n!) permutations or use a kind of optimization algorithm say Branch and Bound method or Genetic algorithms. The last algorithms is only check the Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 3 jours
(1 Évaluation)

I have read your project and I am an expert in this field. I can do this for you within due time and honestly. I also have a few questions to discuss. Kindly contact me and we will discuss time and budget. Thanks

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 7 jours
(14 Commentaires)

Hello! I'd like to help you with this theory of algorithms assignment! I'm familiar with various data structures as well search ones. I can do the job blazingly fast. Please, give me a try!

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(1 Évaluation)

I know how to implement described solution. You could accept me and i will share my expertise with you. About me: Senior SQL Developer with 10+ years experience, worked during this time with several automation system Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 2 jours
(2 Commentaires)

I have read your project description and I am interested in the project. As you can see my profile, I am a full-time developer and have just completed many projects. Specially, I have wide experience in C/C++, C#, Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 2 jours
(1 Évaluation)

Hello sir, i can complete this function very easily within 30 minutes. It will return minimum required time, giving waiting time for all the schedule. drop a message and lets discuss about it

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(1 Évaluation)

hello sir I am a full time freelancer and have 10 years of experience in web and window development in asp.net c#, javascript, . i can do work as per your requarment pls inbox me so that we can talk. Thanks

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 7 jours
(0 Commentaires)

I am a python developer with 3 year experience. I make a point to write my code in a consistent style adhering to the PEP8 style document. Reply me as soon as possible so we can discuss further details. Thank you!

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 7 jours
(0 Commentaires)

I had BSc and MSc degree in Applied Mathematics and Informatics (gpa 4.8). Also undertaken postgraduate studies in Information and Navigation Systems (PhD candidate). I had solid experience in Python, C backgrounding b Plus

%bids___i_sum_sub_35% %project_currencyDetails_sign_sub_36% USD en 7 jours
(0 Commentaires)

Hello customer. I understood all details of your project. I have enough experience about optimization such as your project. As you can see, I am C, Python and C++ language expert. I think that it requires high algorith Plus

%bids___i_sum_sub_32% %project_currencyDetails_sign_sub_33% USD en 1 jour
(0 Commentaires)