Click here to Skip to main content
15,921,905 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionTrapping the Active Page in a CPropertySheet in MFC using CStrings Pin
Larry Mills Sr14-Nov-09 7:15
Larry Mills Sr14-Nov-09 7:15 
AnswerRe: Trapping the Active Page in a CPropertySheet in MFC using CStrings Pin
«_Superman_»14-Nov-09 8:16
professional«_Superman_»14-Nov-09 8:16 
GeneralRe: Trapping the Active Page in a CPropertySheet in MFC using CStrings Pin
Larry Mills Sr14-Nov-09 8:39
Larry Mills Sr14-Nov-09 8:39 
GeneralRe: Trapping the Active Page in a CPropertySheet in MFC using CStrings Pin
«_Superman_»14-Nov-09 9:20
professional«_Superman_»14-Nov-09 9:20 
GeneralRe: Trapping the Active Page in a CPropertySheet in MFC using CStrings Pin
Peter Weyzen14-Nov-09 9:56
Peter Weyzen14-Nov-09 9:56 
GeneralRe: Trapping the Active Page in a CPropertySheet in MFC using CStrings Pin
Larry Mills Sr15-Nov-09 6:33
Larry Mills Sr15-Nov-09 6:33 
QuestionSearching table with log n complexity Pin
Cowork14-Nov-09 7:09
Cowork14-Nov-09 7:09 
AnswerRe: Searching table with log n complexity Pin
N a v a n e e t h14-Nov-09 8:17
N a v a n e e t h14-Nov-09 8:17 
I assume you are storing this information in a container that supports iteration.

Cowork wrote:
Each row has client code and product code.
Table is sorted according to clients.
Program should count how many times given client bought products.


So client details will be repeated as one client can purchase multiple products?

With your current storage structure, it is tough to get O(log n) complexity. Work with std::lower_bound to get an iterator to the element matching search criteria. This does a binary search and will have logarithmic complexity. Now move the iterator forward and increment a counter until you reach to a different client. This will have linear complexity.

If you can arrange your data in such a way that client holds the products he purchased, you can get the information easily. std::lower_bound will give the client and call a method on it to get the products purchased. This will lead into logarithmic complexity.

I hope you are aware that binary search is slow on collections that has few items. I believe mixing linear search and binary search depending on the container size will give you better performance.

Smile | :)

Best wishes,
Navaneeth

GeneralRe: Searching table with log n complexity Pin
Cowork14-Nov-09 12:21
Cowork14-Nov-09 12:21 
GeneralRe: Searching table with log n complexity Pin
N a v a n e e t h14-Nov-09 17:37
N a v a n e e t h14-Nov-09 17:37 
QuestionHow my parent window class could be notified of its child's windows movement? Pin
A&Ms14-Nov-09 4:29
A&Ms14-Nov-09 4:29 
AnswerRe: How my parent window class could be notified of its child's windows movement? Pin
BobInNJ14-Nov-09 5:49
BobInNJ14-Nov-09 5:49 
GeneralRe: How my parent window class could be notified of its child's windows movement? Pin
A&Ms14-Nov-09 16:39
A&Ms14-Nov-09 16:39 
GeneralRe: How my parent window class could be notified of its child's windows movement? Pin
BobInNJ19-Nov-09 5:38
BobInNJ19-Nov-09 5:38 
Questionwhy execution time of program varies with identical initial settings? Pin
jianzhuhuai14-Nov-09 1:23
jianzhuhuai14-Nov-09 1:23 
AnswerRe: why execution time of program varies with identical initial settings? Pin
LunaticFringe14-Nov-09 2:41
LunaticFringe14-Nov-09 2:41 
AnswerRe: why execution time of program varies with identical initial settings? Pin
BobInNJ14-Nov-09 5:43
BobInNJ14-Nov-09 5:43 
GeneralRe: why execution time of program varies with identical initial settings? Pin
jianzhuhuai18-Nov-09 3:22
jianzhuhuai18-Nov-09 3:22 
GeneralRe: why execution time of program varies with identical initial settings? Pin
BobInNJ19-Nov-09 5:34
BobInNJ19-Nov-09 5:34 
GeneralRe: why execution time of program varies with identical initial settings? Pin
jianzhuhuai23-Nov-09 0:34
jianzhuhuai23-Nov-09 0:34 
Question[Message Deleted] Pin
kumar sanghvi13-Nov-09 23:56
kumar sanghvi13-Nov-09 23:56 
AnswerRe: singleton Pin
Richard MacCutchan14-Nov-09 0:38
mveRichard MacCutchan14-Nov-09 0:38 
Questioninitialisation inside struct Pin
kumar sanghvi13-Nov-09 23:20
kumar sanghvi13-Nov-09 23:20 
AnswerRe: initialisation inside struct Pin
Richard MacCutchan14-Nov-09 0:47
mveRichard MacCutchan14-Nov-09 0:47 
Questionhow to display a bitmap which have 24 colors Pin
tfzxyinhao13-Nov-09 23:05
tfzxyinhao13-Nov-09 23:05 

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.