Jump to content

Recommended Posts

Posted

Hello everyone , i'm new to this thing so plz help me how to solve the following problem , if anyone can send me the c/c++ code i shall be thankfull to him :) :)

 

 

 

An eccentric doctor visits his patients in order of decreasing age. Patients entering the waiting list specify not only their names but also their ages. Each time the doctor wants to visit a patient, the oldest is selected and removed from the list (so children may have to wait a very long time). Write a program, based on elementary sorting techniques to sort this list on first on Age and then on Patient ID, which this doctor can use.

 

Before

PatientID Name Age

 

P102 Arif Taj Mairza 50

P203 Sadar Khan 65

P546 Afsheen Bano 34

P605 Kai Whong 45

P340 Hanah Duong 23

P391 Usman Habib 65

P200 Alina Shah 34

 

After

PatientID Name Age

 

P203 Sadar Khan 65

P391 Usman Habib 65

P102 Arif Taj Mairza 50

P605 Kai Whong 45

P200 Alina Shah 34

P546 Afsheen Bano 34

P340 Hanah Duong 23

 

 

 

Solve this problem by applying four different elementary sorting techniques that are

 

a) Selection sort

B) Bubble sort

c) Insertion sort

d) Shell sort

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.