Bits, bytes, and all the rest

I need clarification on what some stuff really represents.
My project is to build a Huffman tree (no problem). However, all tutorials and examples that I can find on the net take from a text file with the format <letter> <frequency>, such as:
a 12
b 3
c 4
d 8
Mine has to read any kind of file, such as a text file.
For example, if myDoc.txt contains:
This is my document.
I have to have my program read the bytes from the infile, count the frequency of each byte from 0 through 255. Then the frequencies must be placed on a list of single node Huffman trees, and build the tree from this list.
I think I am having trouble because I just cannot get straight what a byte "looks like". My project says ensure you are not counting the "letters" of the infile, but the "bytes".
So what does a byte look like? When I read in the file as above, what is a "byte" representation of the letter T, i,h, etc?
Any ideas?

Ok, Roshelle....here is a little history lesson that you should have learned or should have been explained to you by your instructor before he/she gave you the assignment to construct a Huffman tree.
A bit is a binary digit which is either 0 or 1 -- it is the only thing that a computer truly understands. Think about it this way, when you turn on the light switch, the light comes on (the computer sees it as a 1), when you turned the switch off, the light goes out (the computer sees it as a 0).
There are 8 bits to a byte -- you can think of it as a mouthful. In a binary number system, 2 to the power of 8 gives you 256. So, computer scientists decided to use this as a basis for assigning a numerical value to each letter of the English alphabets, the digits 0 to 9, some special symbols as well as invisible characters. For example, 0 is equivalent to what is known as null, 1 is CTRL A, 2 is CTRL B, etc...... (this may vary depending on the computer manufacturers).
Now, what was your question again (make sure that you count the byte and not the letters)?
As you can see, when you read data from a file, there may be characters that you don't see such as a carriage return, line feed, tab, etc.....
And like they said, the rest is up to the students!
V.V.

Similar Messages

  • I previously uploaded images onto my desktop to work on in Lightroom 5.2. I worked on a few of the images days ago and just now getting back to them. My problem is I can only access the images I previously worked on and all the rest it says images not ava

    I previously uploaded images onto my desktop to work on in Lightroom 5.2. I worked on a few of the images days ago and just now getting back to them. My problem is I can only access the images I previously worked on and all the rest it says images not available but all the images are still right on my desktop.

    ... and all the rest it says images not available
    Normally this happens because you moved, renamed or deleted these photos (or the folders that contain them) outside of Lightroom. This is how to fix the problem: Adobe Lightroom - Find moved or missing files and folders

  • Itunes won't play one of the song i have purchased in an album and all the rest of the song play

    I recently purchased David Guetta Nothing But the Beat ultimate and have found all the song but one play. The song I am having problems playing is Metropolis it appears to be asking for authorize it, which puzzles me as i have purchased the music from the same device which is authorized.

    Hello TomDee983,
    You may need to delete and redownload the problematic track from the iTunes Store.
    Deleting files from the iTunes library and your computer
    http://support.apple.com/kb/HT3842
    Downloading past purchases from the App Store, iBookstore, and iTunes Store
    http://support.apple.com/kb/HT2519
    Best regards,
    Allen

  • Hi, Can i sync both my MacBook Pro and My Mac Book with the same iCloud, iPhone, iPad and all the rest?

    Hi,
    Can i sync my database both on my Macbook Pro and my Macbook? is it possible to work on both computers and share the same iCloud, iPhone, iPad etc?
    thanks

    @Zizooka : Your question is not very clear ... please re-phrase ... and iCloud is the concept where you share your data through ONLY one account on ALL your devices ...

  • Just bought a new imac and tried to download all my music from my iPod but it only allow me to download purchased items and not the rest of stuff stored on a previous pc itunes folder. How do I get round this ?

    Just bought a new imac and tried to download all my music from my iPod but it only allow me to download purchased items and not the rest of stuff stored on a previous pc itunes folder. How do I get round this ?

    The simplest way to transfer everything is to copy the entire /Music/iTunes/ folder from old computer to /Music/ on new computer.
    See "External Drive" in this article-> iTunes: How to move your music to a new computer

  • I have created a site with iWeb. I have replaced the iWeb Nav bar with a vertical one I made myself. Problem is, my top button disables itself if it overlaps into the "hidden" nav bar area. I can cmd click and drag it into this area, but then all the rest

    I have created a site with iWeb. I have replaced the iWeb Nav bar with a vertical one I made myself. Problem is, my top button disables itself (and the animation doesn't work) if it overlaps into the "hidden" nav bar area (indicated by a blue rectangle). I can cmd click and drag it into this area, but then all the rest of my site is pushed down the page. Don't know what to do about this. I don't know how to bring the rest of the page up without dragging it also into the designated nav bar area. Also, by doing this, is it affecting my site in ant way? see my site here at www.steveburrowsimages.com
    The home page is with it all draged into the nav bar area and the about page is with is outside the nav bar area (notice that the top button does not animate or work as a button.
    Getting confused here. Anyone got any ideas?

    Well, you made a good start with SEO by getting rid of the iWeb default navigation since it doesn't help the spiders and, out there in the real world, there are more people than you would think with javascript turned off in their browsers.
    One of the downsides of iWeb is that it doesn't allow for the alt attribute in the img tag. Its well worth adding these to give you extra keywords even if you have captioned all your images. Use iWeb SEO Tool for this...
    http://www.iwebformusicians.com/Search-Engine-Optimization/Tags.html
    iWeb, just like most drag and drop software, creates a huge amount of code which causes the pages to load slowly in the browser. Running you files through an optimizer will help to reduce this problem and further reduce the size of image files even beyond the initial optimization you do before loading them into iWeb...
    http://www.iwebformusicians.com/Search-Engine-Optimization/Optimize.html

  • When I print to pdf on Mac, the first page comes out fine but all the rest are magnified and shifted up and right

    I click File>Print. Whether I open pdf in Preview, save to pdf, or just print, I get this error. The first page is fine, but all the rest are shifted up and to the right and magnified.
    I've never been able to print out a multi-page document on Firefox with my new computer. I can copy/paste the address to Safari (gross) and it prints just fine, either to pdf or to a hard copy.
    Save me from having to use Safari!

    Making sure the fonts were embedded helped some, but it's still hit and miss. Sometimes I'm still missing pieces. One workaround I have found that works is just print one page without security to PDF, and then go back and replace the bad page(s) with them. So it will print properly, just not all the time. I have a copy of a word page and then what acrobat did to it. I just need to figure out how to post it here.
    Kim

  • I need help to decide which macbook pro is best for photo editing, editing movies and doing all the rest too like excel, word etc. 13"

    I need help to decide which macbook pro is best for photo editing, editing movies and doing all the rest too like  microsoft office products ...excel, word etc.  I am new to the apple world and have liked the idea of the MAC Book Pro 13" but really dont know if this is good enough or if the computer will soon crash?
    13-inch: 2.6GHz
    with Retina display
    Specifications
    2.6GHz dual-core Intel Core i5
    Turbo Boost up to 3.1GHz
    8GB 1600MHz memory
    512GB PCIe-based flash storage1
    Intel Iris Graphics
    Built-in battery (9 hours)2

    That's a fine machine and, with 8GB of RAM and 512GB flash storage should serve you well for light video/photo editing as well as for 'normal' usage. And it should last you for years to come.
    Good luck in making your decision!!
    Clinton

  • HELP!? Remove 1 page from long document and shift all the rest pages

    Hello,
    I am facing to following problem:
    I have a long document with facing pages. Now I need to remove one left page in the middle of the document and shift all the rest pages one step forward. It means from all right pages do a left and vice versa (started from the page that was removed). There is a continous text int the whole document and left/right strip made from different photos.
    To clarify the situation I am attaching the preview. I have deleted page no.12 and I need to shift page 13 to left, 14 to right after 13, 15 to left, 16 to right after 15 and so on....
    Is there any simple way how to do it?
    Thank you very much for any tips.

    It looks to me as if you may something else going on here. Are you using right-to-left text here so the document binding would be onthe right when the book is closed? If not, your problem is not with page 13 so much as it is with the earlier pages.
    Unless you force it to do otherwise by disabling page shuffling someplace, in left-to-right documents using facing pages ID will always put odd numbered pages to the right of the spine and even to the left, the opposite for right-to-left documents. In either case, it seems like you have page shuffling disabled either for the whole file or for a selected spread. You can re-enable it from the menu in the Pages panel. When ID asks if you want to maintain the current number of pages on a spread you should probably say no. Either pages 1-12 will swtch sides, or 13 and following will, and your spreads will rearrange to put two pages together as they should be.
    If you  have overridden master page objects, a side effect of switching sides on the spread will be that the overridden objects will remain and the new master objects from the other side of the spread will appear behind them.

  • I have Lion, and I can't see my unread messages count in the dock, even after the preferences set up. I find the Lion Mail too complicated. Leopard was much easier and more simple to use. I only have one account& don't need all the rest. any suggestions

    I have Lion, and I can't see my unread messages count in the dock, even after the preferences set up.
    I find the Lion Mail too complicated. Leopard was much easier and more simple to use. I only have one account& don't need all the rest.
    any suggestions?

    weird.
    It's so frustrating, I got my Mac Book 5 days ago and I'm already having a discussion in the forum.
    Thank you so much for your prompt replies.
    It's past midnight here so I'd better get some rest...
    Good night captfred!

  • I have 10Gb of photos on my iphone, so can choose only half of it (5Gb) and share it with icloud and leave the rest on my phone storage, or i must share all photos and videos (my whole camera roll)

    I have 10Gb of photos on my iphone, so can choose only half of it (5Gb) and share it with icloud and leave the rest on my phone storage, or i must share all photos and videos (my whole camera roll)

    No.  Your iCloud account only includes your the camera roll photos stored in the backup.  And they can only be accessed by restoring the backup to your phone.  Also, if you delete any photos from your camera roll and continue to back up, the backup that contained the deleted photos would be overwritten by one that doesn't and they would be lost.
    If you want to save some of them and delete them from your phone, import them to your computer as explained here: http://support.apple.com/kb/HT4083. 
    Another option is to import all of them to your computer and delete them from your phone, then put the ones you want on your phone in a folder and sync them back to your phone by selecting the folder on the photos tab of your iTunes sync settings and syncing.  The advantage of this approach is that synced photos are placed in an album called Photo Library, which is not included in the iCloud backup (since they are already backed up on your computer), thereby saving space in your iCloud account (which only backs up camera roll photos).

  • Is it possible to remember one website in the cache and dlete all the rest of the cache?

    I use a program called Visible Body, which takes time load if it is not already cached. I would like to be able to keep it cached, but delte all the rest of the cache. Is this possible?
    Thank you

    Maybe Read It Later: https://addons.mozilla.org/firefox/addon/7661

  • ITunes says my computer isn't authorized to play one song, but all the rest of them work. The song works on my iPad so why won't it work on my computer or my iPod?

    iTunes says my computer isn't authorized to play one of the songs I just downloaded, but all the rest of them work. That song works on my iPad so why won't it work on my computer or my iPod? It says my computer isn't authorized to play that song so I type in my password and it pops up with a menu saying my computer is already authorized and it skips to the next song. No matter what I do it won't play that song on my laptop or my iPod.

    Could be a Corrupt download of that song...
    If you live in a Region that allows re-downloading Music...
    Delete the Song(s) and re-download...
    See Here  >  Download Past Purchases
    http://support.apple.com/kb/HT2519
    If not... Contact iTunes Customer Service
    Apple  Support  iTunes Store  Contact Us

  • How can I select several emails from 3900 on my 5c and delete the rest easily

         How can I select several emails from 3900 on my 5c and delete the rest easily

    We'll I don't think there's a easy way to delete a lot of emails besides deleting all of them. To delete all of them click on inbox them edit then "mark all" then trash/delete. Other than that you will have to specifically deleted the ones you want to delete.

  • Sync some content and stream the rest.

    I have 1 itunes library on my G5 and as i have the original ATV with only the 40gig HD i was wondering if at all possible can i sync some content and stream the rest. Not sure if i have set this up correctly but i cannot achieve both. I have to swap between the synced and streamed and everytime i do this my ATV loses all synced content. If this is achieveable can someone help with setting this up. Thanx in advanced.

    Thanx for the quick reply, i have tried this on several occasions but this has not worked. Cant hurt to try again. When you refer to syncing library, this being the one in itunes and from my ATV set it to connect to itunes and once it appears under summary set it to custom sync.

Maybe you are looking for