Click here to Skip to main content
15,897,891 members
Home / Discussions / C#
   

C#

 
GeneralRe: ToolTip on GDI+ figure Pin
Valeria Bogdevich23-Jul-03 23:15
Valeria Bogdevich23-Jul-03 23:15 
GeneralRe: ToolTip on GDI+ figure Pin
r923-Jul-03 23:29
r923-Jul-03 23:29 
GeneralRe: ToolTip on GDI+ figure Pin
Valeria Bogdevich24-Jul-03 0:18
Valeria Bogdevich24-Jul-03 0:18 
GeneralRe: ToolTip on GDI+ figure Pin
r924-Jul-03 0:23
r924-Jul-03 0:23 
Generalhelppppppppp meeeeeeeee !!! Pin
KETUINHA23-Jul-03 15:51
KETUINHA23-Jul-03 15:51 
GeneralRe: helppppppppp meeeeeeeee !!! Pin
jtmtv1823-Jul-03 16:26
jtmtv1823-Jul-03 16:26 
GeneralCreating Image Encoders/Decoders for GDI+ Pin
J. Dunlap23-Jul-03 13:45
J. Dunlap23-Jul-03 13:45 
GeneralRe: Creating Image Encoders/Decoders for GDI+ Pin
leppie24-Jul-03 7:18
leppie24-Jul-03 7:18 
GeneralAdd Reference Pin
albean23-Jul-03 12:55
albean23-Jul-03 12:55 
GeneralRe: Add Reference Pin
J. Dunlap23-Jul-03 13:22
J. Dunlap23-Jul-03 13:22 
GeneralRe: Add Reference Pin
Derek Lakin23-Jul-03 21:46
Derek Lakin23-Jul-03 21:46 
GeneralRe: Add Reference Pin
Ista24-Jul-03 5:52
Ista24-Jul-03 5:52 
GeneralRe: Add Reference - Thanks Pin
albean24-Jul-03 5:27
albean24-Jul-03 5:27 
GeneralRe: Add Reference Pin
Ista24-Jul-03 6:54
Ista24-Jul-03 6:54 
Generaldatagrid check box Pin
retZ23-Jul-03 12:03
retZ23-Jul-03 12:03 
GeneralRe: datagrid check box Pin
totig23-Jul-03 13:26
totig23-Jul-03 13:26 
GeneralRe: datagrid check box Pin
Radoslav Bielik24-Jul-03 5:04
Radoslav Bielik24-Jul-03 5:04 
GeneralAccess Denied Pin
Alexandru Serban23-Jul-03 11:38
professionalAlexandru Serban23-Jul-03 11:38 
GeneralRe: Access Denied Pin
Julian Bucknall [MSFT]23-Jul-03 13:59
Julian Bucknall [MSFT]23-Jul-03 13:59 
GeneralRe: Access Denied Pin
Alexandru Serban23-Jul-03 19:55
professionalAlexandru Serban23-Jul-03 19:55 
Generalhuffman tree algorithm Pin
jtmtv1823-Jul-03 11:23
jtmtv1823-Jul-03 11:23 
GeneralRe: huffman tree algorithm Pin
totig23-Jul-03 13:27
totig23-Jul-03 13:27 
GeneralRe: huffman tree algorithm Pin
Julian Bucknall [MSFT]23-Jul-03 13:41
Julian Bucknall [MSFT]23-Jul-03 13:41 
I'm kind of puzzled: java and C# are very similar. If you've found a java example of creating a huffman tree than it should be easy to convert it into C#.

To build a huffman tree you'll need two basic classes: the tree and a priority queue. (You need the latter to easily get the nodes or partial trees with the smallest weights every time.)

A huffman tree consists of node objects. Each node object will have a left child node and a right child node, and will have a weight value (the weight being the count of characters in the node and its children). You'll also store the byte value in the node.

So, first do it without regard to performance. Create an array of nodes, one for each possible byte in the input stream (i.e. 256 of them). Read through the input stream, for each byte you update the weight in the relevant node object.

Push all the nodes with non-zero weights in the priority queue.

Pop the top two off. Create a new parent node with weight equal to the sum of the two nodes' weights. The children of this parent are the two nodes popped off.

Push the parent node into the priority queue.

Perform the previous two steps until there is only one node in the queue. This is the huffman tree.


Cheers, Julian
Program Manager, C#

This posting is provided "AS IS" with no warranties, and confers no rights.
GeneralRe: huffman tree algorithm Pin
jtmtv1823-Jul-03 14:46
jtmtv1823-Jul-03 14:46 
GeneralRe: huffman tree algorithm Pin
Frank Olorin Rizzi24-Jul-03 4:11
Frank Olorin Rizzi24-Jul-03 4:11 

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.