Click here to Skip to main content
15,894,955 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Serial Number Via USB Pin
VonHagNDaz17-Oct-06 11:07
VonHagNDaz17-Oct-06 11:07 
QuestionCommon File Dialog (SetControlText) - Vista Pin
me17-Oct-06 3:34
me17-Oct-06 3:34 
AnswerRe: Common File Dialog (SetControlText) - Vista Pin
TomJena6-Dec-09 10:16
TomJena6-Dec-09 10:16 
Questionhow do you code for the automatic generation of employee no Pin
paradise_517-Oct-06 3:31
paradise_517-Oct-06 3:31 
AnswerRe: how do you code for the automatic generation of employee no Pin
Cedric Moonen17-Oct-06 3:34
Cedric Moonen17-Oct-06 3:34 
AnswerRe: how do you code for the automatic generation of employee no Pin
David Crow17-Oct-06 3:56
David Crow17-Oct-06 3:56 
Questionhow to create two views for one doc in MDI Pin
chethu66517-Oct-06 2:25
chethu66517-Oct-06 2:25 
QuestionConstructing a Tree Pin
llp00na17-Oct-06 1:59
llp00na17-Oct-06 1:59 
Dear everyone;

I have got a pure C++/ algorithmic question that i would appreciate your input towards.

I have a number of files (lets say 100 files) of similar input formats (Strings). To reduce the complexity of the problem I will give you a simplied example:

File 1:       File 2:       File 3:       File4:            
A             A             B             A           
B             E             A             B
C             D             D             A
D             D             F             E
E             F             E             E


I want to write a program which reads the files and produces a tree, in which the first node is the node from the first line (from above) with the highest number of occurences (so we basically check every first item in each file 'A, A, B, A' in this case. Item 'A' has occured three times so it will represent the root node). Consequently File 3 is ignored.

The resulting tree will be something like
                           A (3/4 occurrences = 75%)
              B ( 2/4 occurrences = 50%)             E (1/4 occurrences = 25%)
C (1 occurrence=25%)     A (1 occurrence= 25%)       D (1 occurrence=25%)
                      D (2/4 occurrences = 50%)    E (1 occurrence = 25%)
                      E (2/4 occurrences = 50%)    F (1 occurrence = 25%)


SO basically the program should go through the files and construct a tree with a % value of each node. every time branching occurs the % will be divided depending on the number of children.

My question is, is there any specific algorithm / similar algorithms which i can use to overcome this problem ? and What's the best way to visualise the tree?

Your help is very much appreciated
Best Regards

llp00na

AnswerRe: Constructing a Tree Pin
me17-Oct-06 3:52
me17-Oct-06 3:52 
GeneralRe: Constructing a Tree Pin
llp00na17-Oct-06 5:39
llp00na17-Oct-06 5:39 
QuestionRe: Constructing a Tree Pin
David Crow17-Oct-06 3:53
David Crow17-Oct-06 3:53 
AnswerRe: Constructing a Tree Pin
llp00na17-Oct-06 5:46
llp00na17-Oct-06 5:46 
Questionhow resource editor works in Vc++ Pin
AghaJaffer17-Oct-06 1:58
AghaJaffer17-Oct-06 1:58 
AnswerRe: how resource editor works in Vc++ Pin
Mark Salsbery17-Oct-06 6:55
Mark Salsbery17-Oct-06 6:55 
Questionhow resource editor works in Vc++ Pin
AghaJaffer17-Oct-06 1:56
AghaJaffer17-Oct-06 1:56 
QuestionCArchive Pin
Mohammad Khodaii17-Oct-06 1:46
Mohammad Khodaii17-Oct-06 1:46 
AnswerRe: CArchive Pin
David Crow17-Oct-06 2:54
David Crow17-Oct-06 2:54 
Questioncreating a new window Pin
prithaa17-Oct-06 1:25
prithaa17-Oct-06 1:25 
QuestionToolTip Pin
zon_cpp17-Oct-06 1:06
zon_cpp17-Oct-06 1:06 
AnswerRe: ToolTip Pin
Hamid_RT17-Oct-06 1:08
Hamid_RT17-Oct-06 1:08 
AnswerRe: ToolTip Pin
toxcct17-Oct-06 1:34
toxcct17-Oct-06 1:34 
QuestionOne Question ?.. Pin
Sakthiu17-Oct-06 0:56
Sakthiu17-Oct-06 0:56 
QuestionRe: One Question ?.. Pin
David Crow17-Oct-06 3:04
David Crow17-Oct-06 3:04 
AnswerRe: One Question ?.. Pin
Sakthiu17-Oct-06 3:50
Sakthiu17-Oct-06 3:50 
QuestionRe: One Question ?.. Pin
David Crow17-Oct-06 4:04
David Crow17-Oct-06 4:04 

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.