Binary Tree Crypto

This is a discussion on Binary Tree Crypto within the C++ Programming forums, part of the General Programming Boards category; this is a rather interesting assignment i have, and i have no clue where to start with it. my instructor ...

  1. #1
    Registered User
    Join Date
    Apr 2004
    Posts
    1

    Binary Tree Crypto

    this is a rather interesting assignment i have, and i have no clue where to start with it.

    my instructor gave us a header for a binary tree that accepts and sorts strings. we must use it to take a single word (such as a name) , break it into its component letters and numbers, and insert them into a tree. then we must assaign each letter a 'path' meaning, it converts each letter into a number based upon the direction it had to move down the tree to get to that letter. for example, moving left would be '0', and moving right would be '1', then hold would be '2'.

    basically, i have no idea where to even start, i just want to get an idea what others would do so that i can use that as a jump off point.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,855
    And we're supposed to extrapolate the answer to your question when all you've given us is a snippet of the information you have to hand?
    Like for example, what tree routines do you have available

    > i have no idea where to even start
    Breaking words into letters and adding them to a tree would show us (and you) something at least

    > based upon the direction it had to move down the tree
    So say 'q' would be "01001101" as a series of left/right branches
    Build a tree, then print some paths
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Also, google for huffman compression.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  4. #4
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    Yeah, this sounds like the Huffman encoding scheme; thus, your subject title is a misnomer. Huffman encoding is used for data compression, not cryptography. It's still wicked cool, though.
    FAQ

    "The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.

    "If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >Huffman encoding is used for data compression, not cryptography.
    Compression algorithms can often be used as simple encryption.
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 0
    Last Post: 11-04-2006, 11:07 AM
  2. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 04:00 PM
  3. Tutorial review
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 03-22-2004, 09:40 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. BST/Red and Black Tree
    By ghettoman in forum C++ Programming
    Replies: 0
    Last Post: 10-24-2001, 11:45 PM

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