Eye Spy - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

Eye Spy

Description:

Eye Spy. Episode Three. Cracking the Code. You don't need this. I have it here for demo ... char at a time and search for that node on the tree using a ... – PowerPoint PPT presentation

Number of Views:141
Avg rating:3.0/5.0
Slides: 12
Provided by: csUa1
Category:
Tags: eye | search | spy

less

Transcript and Presenter's Notes

Title: Eye Spy


1
Eye Spy
  • Episode Three
  • Cracking the Code

2
cipher.txt
You should be able to do this. Open a ciphertext
file and display it like you did in NadaJava.
You dont need this I have it here for
demo purposes only.
test.txt
3
Deciphering
  • Pass the entire String object that contains the
    ciphertext to your binary tree object.
  • Your method should take a string as a parameter
    and return a string object.
  • Put this string in your JTextArea designated for
    plaintext.
  • If all went well, you should be able to read it!

4
K.I.S.S.
  • I start with an empty plaintext string.
  • I set walk to root.
  • A nice little for-loop the length of the string
    works.
  • I love switch statements.
  • if the character is ., walk goes left.
  • if the character is -, walk goes right
  • if its a blank, then
  • get the letter from this node
  • append it to your plaintext string
  • set walk back to root so we can start from the
    top again with the next letter

5
(No Transcript)
6
Enciphering
You should be able to do this. Open a ciphertext
file and display it like you did in NadaJava.
You dont need this I have it here for
demo purposes only.
7
Enciphering
  • You should be able to use a for-loop the length
    of the plaintext string, tear off one char at a
    time and search for that node on the tree using a
    preorder traversal strategy.
  • My preorder traversal method is called locate.

8
Locate
  • I pass in a node (first call passes root), and a
    string (convert the char on the string to a
    string so you can use the equals method or else
    be like MacDonalds and do it your own way.)
  • I return a node object.

9
Base Case
  • If you get a null node, return null.
  • If you get a node that has an alpha field that
    matches the one you want, return that node.
  • Otherwise, set a new node, say, x to locate of
    the left node of the one passed in.
  • If its not null, we must have found it, so
    return x.
  • Otherwise, return locate of the right node of
    the one passed in.

10
(No Transcript)
11
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com