Click here to Skip to main content
15,390,899 members
Home / Discussions / Algorithms
   

Algorithms

 
Questionproblem in Theta-θ Notation Pin
Arjun Tirumalasetty25-May-15 2:21
MemberArjun Tirumalasetty25-May-15 2:21 
QuestionGeometry domain problem in Competitive algorithm Pin
Chaitanya Pai23-May-15 1:34
MemberChaitanya Pai23-May-15 1:34 
SuggestionRe: Geometry domain problem in Competitive algorithm Pin
Richard MacCutchan23-May-15 2:09
mveRichard MacCutchan23-May-15 2:09 
QuestionBase 36 value math problem Pin
stoneyowl25-May-15 7:41
Memberstoneyowl25-May-15 7:41 
AnswerRe: Base 36 value math problem Pin
Matt T Heffron5-May-15 8:12
professionalMatt T Heffron5-May-15 8:12 
GeneralRe: Base 36 value math problem Pin
stoneyowl25-May-15 9:33
Memberstoneyowl25-May-15 9:33 
QuestionRe: Base 36 value math problem Pin
Matt T Heffron6-May-15 7:49
professionalMatt T Heffron6-May-15 7:49 
GeneralRe: Base 36 value math problem Pin
Daniel Pfeffer6-May-15 21:21
professionalDaniel Pfeffer6-May-15 21:21 
You can implement this with a form of binary search.
  1. [Preparation] Sort the strings representing the first ticket in each book in ascending order:
    a. zero-pad any short strings (e.g. "ABC1" should be padded to "00ABC1"
    b. sort the strings using a case-insensitive sort
    c. pad the list with a dummy ending value (e.g. "ZZZZZZ").
    d. pad the list with a dummy starting value (e.g. "000000").
  2. [Eliminate low values] Use a binary search to find the location of largest value less than or equal to the target string. If the result points to the starting dummy value, then no such value exists.
  3. [Eliminate high values] Use a binary search to find the location of the smallest value larger than the target string. If the result points to the ending dummy value, then no such value exists.
The range [low, high) contains your result. If low != high, the range should contain a single element that is the desired ticket book. If low == high, no ticket book was found.

Note that you can handle missing books in the sequence by adding dummy book starting values to the array.
If you have an important point to make, don't try to be subtle or clever. Use a pile driver. Hit the point once. Then come back and hit it again. Then hit it a third time - a tremendous whack.

--Winston Churchill

AnswerRe: Base 36 value math problem Pin
Gerry Schmitz5-May-15 9:53
mveGerry Schmitz5-May-15 9:53 
GeneralRe: Base 36 value math problem Pin
stoneyowl25-May-15 9:58
Memberstoneyowl25-May-15 9:58 
GeneralRe: Base 36 value math problem Pin
Gerry Schmitz5-May-15 10:15
mveGerry Schmitz5-May-15 10:15 
AnswerRe: Base 36 value math problem Pin
Patrice T17-Jun-15 19:00
mvePatrice T17-Jun-15 19:00 
AnswerRe: Base 36 value math problem Pin
Frankie-C6-May-15 7:01
MemberFrankie-C6-May-15 7:01 
SuggestionRe: Base 36 value math problem Pin
Matt T Heffron6-May-15 7:41
professionalMatt T Heffron6-May-15 7:41 
GeneralRe: Base 36 value math problem Pin
Frankie-C7-May-15 2:07
MemberFrankie-C7-May-15 2:07 
AnswerRe: Base 36 value math problem Pin
Patrice T17-Jun-15 18:37
mvePatrice T17-Jun-15 18:37 
GeneralRe: how does C4.5 work? Pin
PIEBALDconsult25-Apr-15 7:46
professionalPIEBALDconsult25-Apr-15 7:46 
AnswerRe: how does C4.5 work? Pin
pt140125-Apr-15 8:39
Memberpt140125-Apr-15 8:39 
AnswerRe: how does C4.5 work? Pin
Richard MacCutchan25-Apr-15 20:54
mveRichard MacCutchan25-Apr-15 20:54 
AnswerRe: how does C4.5 work? Pin
Kornfeld Eliyahu Peter25-Apr-15 21:01
professionalKornfeld Eliyahu Peter25-Apr-15 21:01 
AnswerRe: algorithm Pin
Sascha Lefèvre25-Apr-15 7:37
professionalSascha Lefèvre25-Apr-15 7:37 
Questionalgorithm Pin
Deepak Pundir17-Apr-15 9:10
MemberDeepak Pundir17-Apr-15 9:10 
AnswerRe: algorithm Pin
Sascha Lefèvre17-Apr-15 9:48
professionalSascha Lefèvre17-Apr-15 9:48 
GeneralRe: algorithm Pin
harold aptroot17-Apr-15 9:54
Memberharold aptroot17-Apr-15 9:54 
GeneralRe: algorithm Pin
PIEBALDconsult15-May-15 14:42
professionalPIEBALDconsult15-May-15 14: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.