Click here to Skip to main content
15,926,857 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Efficient way to delete lines from CEdit Pin
EiSl18-Jun-01 21:01
EiSl18-Jun-01 21:01 
GeneralCharacter Message Pin
vijayaramaraju17-Jun-01 20:39
vijayaramaraju17-Jun-01 20:39 
GeneralRe: Character Message Pin
17-Jun-01 21:08
suss17-Jun-01 21:08 
GeneralRe: Character Message Pin
vijayaramaraju18-Jun-01 1:29
vijayaramaraju18-Jun-01 1:29 
GeneralDisconnected Recordsets problem Pin
yamini17-Jun-01 20:38
yamini17-Jun-01 20:38 
GeneralFaxing Pin
ThomasKennedyBose17-Jun-01 19:07
ThomasKennedyBose17-Jun-01 19:07 
GeneralRe: Faxing Pin
Michael P Butler18-Jun-01 1:13
Michael P Butler18-Jun-01 1:13 
GeneralQueue Permentation Problem Pin
Snail17-Jun-01 19:05
Snail17-Jun-01 19:05 
i got this programming assignment that i cannot figure out how to design an algorithm for ... is someone could help, please do ... thanks .... here is the problem:

suppose the integers 1,2,3,...n are given in this order and offered as input to a collection of two queues, queue 'q0' and queue 'q1'. the number '1' is given first, followed by '2', etc. this input sequence can be permuted in different orders by executing the queue operations q0.enq, q1.enq, q0.deq, and q1.deq a particular order. for example, if the input sequence 1,2,3, then five different outputs can be obtained:

OUTPUT: CONTROL SEQUENCE:
1,2,3 q0.enq, q1.enq, q0.enq, q0.deq, q1.deq, q0.deq
1,3,2 q0.enq, q0.enq, q1.enq, q0.deq, q1.deq, q0.deq
2,1,3 q0.enq, q1.enq, q1.enq, q1.deq, q0.deq, q1.deq
2,3,1 q0.enq, q1.enq, q1.enq, q1.deq, d1.deq, q0.deq
3,1,2 q0.enq, q0.enq, q1.enq, q1.deq, q0,deq, q0.deq
3,2,1 not possible

Not all permutations on n integers are possible as output, as illustrated above with desired output 3,2,1, and some permutations have many possible solutions. in fact, the sequence 1,2,3 can always be recovered regardless how the numbers are distributed over the queues q0 and q1 and this project is to write an algorithm that determies if the desired output sequence is possible, and if so, which sequence leads up to it. we will do this by attaching two contol numbers to the control sequence, one control number for the 'enqueues' and one for the 'dequeues', as followeds: interpret and 'q0.enq' as '0' and an 'q1.enq' as '1', so that the sequence of enq's becomes a string of 0's and 1's, that can be interpreted as a binary number. the same can be done for the deq's. thus the above table becomes:

OUTPUT: enq-number deq-number
1,2,3 (010)=2 (010)=2
1,3,2 (001)=1 (101)=5
2,1,3 (011)=3 (101)=5
2,3,1 (011)=3 (110)=6
3,1,2 (001)=1 (100)=2
3,2,1 not possible

okay ... hopefully you understand what my project is, if someone could help me out with the algorithm for this problem i would be in great debt to you ... btw, if you are concerned about this being illegal to help me on the project, don't be ... we are allowed to get help from published sources ... ie here ... thank you

Generalplease help, i'll take any suggestions Pin
18-Jun-01 7:59
suss18-Jun-01 7:59 
GeneralDialog with ALPHA EFFECT Pin
17-Jun-01 18:27
suss17-Jun-01 18:27 
GeneralRe: Dialog with ALPHA EFFECT Pin
Tomasz Sowinski17-Jun-01 23:05
Tomasz Sowinski17-Jun-01 23:05 
GeneralDirectshow ( BitBucket Filter) Pin
17-Jun-01 17:35
suss17-Jun-01 17:35 
Generaldynamic control creation Pin
kshathrya17-Jun-01 17:12
kshathrya17-Jun-01 17:12 
GeneralRe: dynamic control creation Pin
Tim Deveaux18-Jun-01 3:55
Tim Deveaux18-Jun-01 3:55 
GeneralDos Full path Format API Pin
Fady Elias17-Jun-01 15:00
Fady Elias17-Jun-01 15:00 
GeneralRe: Dos Full path Format API Pin
Matt Gullett17-Jun-01 15:47
Matt Gullett17-Jun-01 15:47 
GeneralCString 2 CHar Pin
17-Jun-01 11:15
suss17-Jun-01 11:15 
GeneralRe: CString 2 CHar Pin
Christian Graus17-Jun-01 11:20
protectorChristian Graus17-Jun-01 11:20 
GeneralRe: CString 2 CHar Pin
18-Jun-01 1:04
suss18-Jun-01 1:04 
GeneralRe: CString 2 CHar Pin
vijayaramaraju18-Jun-01 1:40
vijayaramaraju18-Jun-01 1:40 
Generaltrapping dlgbar sys commands Pin
Wayne Janaway17-Jun-01 7:36
Wayne Janaway17-Jun-01 7:36 
GeneralRe: trapping dlgbar sys commands Pin
Tomasz Sowinski17-Jun-01 23:36
Tomasz Sowinski17-Jun-01 23:36 
GeneralRe: trapping dlgbar sys commands Pin
Wayne Janaway18-Jun-01 13:14
Wayne Janaway18-Jun-01 13:14 
GeneralRe: trapping dlgbar sys commands Pin
Tomasz Sowinski19-Jun-01 0:32
Tomasz Sowinski19-Jun-01 0:32 
GeneralRe: trapping dlgbar sys commands Pin
Wayne Janaway19-Jun-01 11:41
Wayne Janaway19-Jun-01 11:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.