Jump to content

sorting code c/c++

Featured Replies

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

Archived

This topic is now archived and is closed to further replies.

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.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.