Binary Trees

This is a discussion on Binary Trees within the C++ Programming forums, part of the General Programming Boards category; I'm thinking about writing a program which utilizes huffman encoding, however, I need to set up a binary tree to ...

  1. #1
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    Posts
    1,916

    Question Binary Trees

    I'm thinking about writing a program which utilizes huffman encoding, however, I need to set up a binary tree to do this. I was wondering how everyone here would go about doing that...I was thinking that a struct with pointers to the left and right node and a variable for data (for use when it is a leaf) would work, dynamically allocating all the nodes like some twisted version of a linked list, but it seems that I'll also be using a lot of storage (relatively speaking) compared to the amount of data I'm actually storing. Are there any better ways of doing this?
    Away.

  2. #2
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493
    I've made a huffman compression program that works like that. I stored the tree in lookup-table form, and it only cost a few thousand bytes, at most. Mine wasn't very efficient, though. But usually the files were smaller than I started with, including the lookup table.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A Binary Search Tree of... Binary Search Trees...
    By SlyMaelstrom in forum C++ Programming
    Replies: 5
    Last Post: 12-10-2005, 01:12 PM
  2. Binary Trees
    By wvu2005 in forum C Programming
    Replies: 7
    Last Post: 10-15-2005, 04:59 PM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Tutorial review
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 03-22-2004, 08:40 PM
  5. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 09:33 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21