Click here to Skip to main content
14,486,704 members

ATL / WTL / STL

 
PinnedHOW TO ANSWER A QUESTION PinPopular
Chris Maunder16-Jul-09 3:09
cofounderChris Maunder16-Jul-09 3:09 
PinnedHow to get an answer to your question PinPopular
Chris Maunder16-Jul-09 3:05
cofounderChris Maunder16-Jul-09 3:05 
QuestionKeypad locks Pin
Member 79891227-Mar-20 13:23
MemberMember 79891227-Mar-20 13:23 
For those who enjoy playing with algoritms ... A two-step problem: The simple part, make something that works. The difficult part: Provomg that your solution is the optimal one.

Disclaimer: I have no clue about the second part.

Problem: We have a keypad lock at our work facilities. You present your card, and then if the last four digits typed are a valid entry code, the door opens. So if a valid code is 2345, and you type 1234, the door doesn't open. If you then add a 5, the door opens.

An algoritm for trying all possible keys is like the first homework assignment in 101 Elementary Programming.

If you have no knowledge of any entry code, but you know that if the last four digits are correct, the door will open, what will be your dialing strategy for making the minimal nunber of keys dialled to get in? What will be the worst case number of digits dialled? Can you prove that this it the theoretically best, that no other algorithm will provide a lower worst case?

What will be the average across all possible entry codes? Can you prove that your algorithm provides the minimal number of total keypresses in the average case?

I do not have any ready-made "right answer" to this problem, just a bunch of implementations of how to make sure I get it if I have forgotten the code Smile | :) with no complexity analysis. I do know the code, so I do get in - don't worry about that! The problem here is not to get in, but the complexity of getting in if you do NOT know the code!
QuestionTo insert a node at the back of a XOR doubly linked list Pin
Tarun Jha17-Oct-19 9:38
MemberTarun Jha17-Oct-19 9:38 
AnswerRe: To insert a node at the back of a XOR doubly linked list Pin
ZurdoDev10-Jan-20 1:02
mveZurdoDev10-Jan-20 1:02 
QuestionWhy non-template function does not compile where as template function compiles? Pin
PBMBJoshi2-May-19 23:23
MemberPBMBJoshi2-May-19 23:23 
AnswerRe: Why non-template function does not compile where as template function compiles? Pin
Richard MacCutchan2-May-19 23:29
mveRichard MacCutchan2-May-19 23:29 
AnswerRe: Why non-template function does not compile where as template function compiles? Pin
k505410-Oct-19 8:53
Memberk505410-Oct-19 8:53 
QuestionAdvice on interdependent asynchronous functions and task queuing? Pin
arnold_w7-Feb-19 23:07
Memberarnold_w7-Feb-19 23:07 
AnswerRe: Advice on interdependent asynchronous functions and task queuing? Pin
arnold_w7-Feb-19 23:34
Memberarnold_w7-Feb-19 23:34 
QuestionRecommended way to deal with queues and pointers to buffers Pin
arnold_w3-Feb-19 9:09
Memberarnold_w3-Feb-19 9:09 
AnswerRe: Recommended way to deal with queues and pointers to buffers Pin
Richard MacCutchan3-Feb-19 22:19
mveRichard MacCutchan3-Feb-19 22:19 
GeneralRe: Recommended way to deal with queues and pointers to buffers Pin
arnold_w3-Feb-19 23:40
Memberarnold_w3-Feb-19 23:40 
GeneralRe: Recommended way to deal with queues and pointers to buffers Pin
Richard MacCutchan3-Feb-19 23:48
mveRichard MacCutchan3-Feb-19 23:48 
GeneralRe: Recommended way to deal with queues and pointers to buffers Pin
arnold_w4-Feb-19 3:15
Memberarnold_w4-Feb-19 3:15 
GeneralRe: Recommended way to deal with queues and pointers to buffers Pin
Richard MacCutchan4-Feb-19 3:46
mveRichard MacCutchan4-Feb-19 3:46 
GeneralRe: Recommended way to deal with queues and pointers to buffers Pin
arnold_w4-Feb-19 3:55
Memberarnold_w4-Feb-19 3:55 
GeneralRe: Recommended way to deal with queues and pointers to buffers Pin
Richard MacCutchan4-Feb-19 4:04
mveRichard MacCutchan4-Feb-19 4:04 
GeneralRe: Recommended way to deal with queues and pointers to buffers Pin
Business2sell18-Feb-19 18:08
professionalBusiness2sell18-Feb-19 18:08 
QuestionCan a union in standard C "skip" members? Pin
arnold_w31-Jan-19 22:46
Memberarnold_w31-Jan-19 22:46 
AnswerRe: Can a union in standard C "skip" members? Pin
Richard MacCutchan31-Jan-19 23:18
mveRichard MacCutchan31-Jan-19 23:18 
GeneralRe: Can a union in standard C "skip" members? Pin
arnold_w31-Jan-19 23:47
Memberarnold_w31-Jan-19 23:47 
GeneralRe: Can a union in standard C "skip" members? Pin
Richard MacCutchan31-Jan-19 23:52
mveRichard MacCutchan31-Jan-19 23:52 
GeneralRe: Can a union in standard C "skip" members? Pin
arnold_w1-Feb-19 0:13
Memberarnold_w1-Feb-19 0:13 
GeneralRe: Can a union in standard C "skip" members? Pin
Richard MacCutchan1-Feb-19 1:42
mveRichard MacCutchan1-Feb-19 1:42 

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.