Click here to Skip to main content
11,721,385 members (81,546 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++
please help me to understand this question


Consider university human resource system that take the degree of the job applicant
and assign an ID for them (i.e. Sequential number).

Initial Step:

(Suppose you only receive 20 applicant every year ) your program should take the degrees of each applicant and store it in an array. Since the index of array represents the ID of the applicant like the following: index+1=ID
The degrees are (Diploma, bachelor, master, PHD, Professor).If the user insert 1 it means professor degree and so on.

Degree Equivalent number
Professor Degree 1
PHD 2
Master 3
Bachelor 4
Diploma 5

EX: First applicant has Master degree ,second applicant has Professor degree, third applicant has Diploma degree…, so the array will be:

0 1 2
3
1 5 …

Main step:

convert the array to Implement Priority Queue with Sorted Sequence (use linked list to implement the Priority Queue).
Since : the value = ID (ID = array index +1 ) .
the key =Degree (it means professor has the highest priority then key=1 and so on).

in your code, you have to go element by element in the array and insert that element in your new Priority Queue with Sorted Sequence (enqueue) . be sure you insert the element in the appropriate position.
Hint: if two entries have the same priority ( i.e. have the same key) then the new entry with same key value will be inserted after the already existing entry.
Posted 16-Dec-12 11:26am
kenda.m303

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You need to create a priority queue ( a container where elements have a priority and thus are stored in an order dependant on their data ), and push the elements of an array in to that container. If you're inserting at the correct position in your code, that means you're not really creating a priority queue, you're using a linked list and inserting elements at the correct position in your own code, not in the container code. A list is good for this because inserts in the middle of a list are not expensive ( that is, they are quick )
  Permalink  
Comments
Member 9690156 at 16-Dec-12 17:43pm
   
please can you explain more??
Christian Graus at 16-Dec-12 17:44pm
   
If you don't understand my answer, you should talk to your teacher. The idea is simple - move your data from an array to a linked list ( I am unclear if they want you to use the STL list or write your own ). You need to insert items based on a priority that is set from the data. That is all, it's a trivial task.
Member 9690156 at 16-Dec-12 18:11pm
   
i am beginner.....it's trivial task for you
Christian Graus at 16-Dec-12 18:13pm
   
Sure - it's meant to be slightly challenging and a learning experience for you. So, if it's overwhelming, then you really are very lost, and so you should talk to your teacher, not random strangers on the web. Your teacher needs to know you're this confused by this task and can offer you better help than we can.
Member 9690156 at 16-Dec-12 18:18pm
   
thanks.....but i must send my answer to my techer Tomorrow
he asked me a personal effort to resolve it
Christian Graus at 16-Dec-12 18:20pm
   
You should certainly read www.cplusplus.com/reference/list/list, and if you still can't even try to do this, you should question your ability to do this course, especially without some paid tutoring or something to get you over understanding some basics.
pwasser at 16-Dec-12 20:11pm
   
Why are you here? What don't you understand about your teacher's instructions?
Member 9690156 at 16-Dec-12 20:15pm
   
i dont understand (what is the output??)
pwasser at 16-Dec-12 20:17pm
   
Down to you now. Get off your backside and do some work. You may even find if you expend a modicum of effort that Google can help.
Member 9690156 at 16-Dec-12 20:19pm
   
????
Christian Graus at 16-Dec-12 20:23pm
   
We can't help more without doing your work. Talk to your teacher and discuss if you're capable of doing this course, or not
Member 9690156 at 16-Dec-12 20:26pm
   
you are'nt cute ...i'm sorry to write here
any way...i search and understand without you "Christian Graus"
Christian Graus at 16-Dec-12 20:27pm
   
If you found a way to start doing your work, that's great. I'm sorry, if my answer was wrong, your question was unclear. Either way, good luck
pwasser at 16-Dec-12 20:24pm
   
Work - Physical or mental effort or activity directed toward the production or accomplishment of something.
Member 9690156 at 16-Dec-12 20:28pm
   
if do not want to help, there is no need for philosophy "pwasser"
Sergey Alexandrovich Kryukov at 17-Dec-12 0:02am
   
I almost felt sympathy to you, a poor student having trouble because of tomorrow's burden until you started to get rude. Essentially, you are trying to say "shut up, you and you". People were trying to help you; and you... "no need for philosophy"... what a miserable murmuring... Your failure is well deserved.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 440
1 OriginalGriff 229
2 Mika Wendelius 170
3 F-ES Sitecore 80
4 cyycoish 70
0 Sergey Alexandrovich Kryukov 2,209
1 OriginalGriff 969
2 F-ES Sitecore 660
3 Maciej Los 609
4 Richard MacCutchan 560


Advertise | Privacy | Mobile
Web03 | 2.8.150901.1 | Last Updated 16 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100