Menu

[Solved]Need Help C Assignment S Practice Dont Know Begin Please Use Skeleton Code Gave S Needed P Q37151442

Need help with this C++ Assignment! It’s for practice but dontknow where to begin… please use the skeleton code i gave, itswhat’s needed for the practice, just dont know how to fill itout

implement the interface of a Huffman Tree class to encode anddecode data based on character frequencies.

#include “huffman_tree.h”

  

           /*

           Preconditions: file_name is the name of (and possibly path to) atext file

           Postconditions: Reads the contents of file_name and constructsa

                                                           huffman tree based on the character frequencies of the filecontents

           */

           huffman_tree::huffman_tree(const std::string &file_name){

           

           }

           

           huffman_tree::~huffman_tree(){

           

           }

           

           /*

           Preconditions: Character is a character with an ASCII value

                                                           between 0 and 127 (inclusive).

           Postconditions: Returns the Huffman code for character if characteris in the tree

                                                           and an empty string otherwise.

           */

           std::string huffman_tree::get_character_code(char character) const{

                       return “”;

           }

           

           /*

           Preconditions: file_name is the name of (and possibly path to) atext file

           Postconditions: Returns the Huffman encoding for the contents offile_name

                                                           if file name exists and an empty string otherwise.

                                                           If the file contains letters not present in the huffman_tree,

                                                           return an empty string

           */

           std::string huffman_tree::encode(const std::string &file_name)const {

                       return “”;

           }

           

           /*

           Preconditions: string_to_decode is a string containingHuffman-encoded text

           Postconditions: Returns the plaintext represented by the string ifthe string

                                                           is a valid Huffman encoding and an empty string otherwise

           */

           std::string huffman_tree::decode(const std::string&string_to_decode) const {

                       return “”;

           }

===== below is the header file

#ifndef _HUFFMAN_TREE_H_

#define _HUFFMAN_TREE_H_

#include <iostream>

class huffman_tree {

           public:

                       huffman_tree(const std::string &file_name);

                       ~huffman_tree();

                       

                       std::string get_character_code(char character) const;

                       std::string encode(const std::string &file_name) const;

                       std::string decode(const std::string &string_to_decode)const;      

};

#endif

Expert Answer


Answer to Need help with this C++ Assignment! It’s for practice but dont know where to begin… please use the skeleton code i gav… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *