Giter Club home page Giter Club logo

adaptive-huffman's People

Contributors

santensuru avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

adaptive-huffman's Issues

A bit confused about the delete_tree function

void delete_tree(node **tree) {
	if ((*tree)->left != NULL) {
		delete_tree(&(*tree)->left);
	}

	if ((*tree)->right != NULL) {
		delete_tree(&(*tree)->right);
	}
      
       // At this point,  (*tree)->left = NULL && (*tree)->right == NULL.  Right?
	if ((*tree) != NULL) {
		if ((*tree)->parent != NULL && (*tree)->left == NULL) {
			(*tree)->parent->left = NULL;
			free(*tree);
		}
		else if ((*tree)->parent != NULL && (*tree)->right == NULL) {
                        //  no chance enter here

			(*tree)->parent->right = NULL;
			free(*tree);
		}
		else if ((*tree)->right == NULL && (*tree)->left == NULL) {
			free(*tree);
			(*tree) = NULL;
		}
	}

	return;
}

I think that (*tree)->parent->right = NULL; has no chance to execute.
I wonder if you can explain it to me. Thank you!

.ah file

Why is the extension of encoded file .ah?

how to run

Hello, i have an issue compiling the program.
When a write "gcc vitter.cpp input.txt" in the widows terminal, it doesn't work and it says.
"warning: input.txt: linker input file unused because linking not done"
Can you please help me ?

Fix for stack crash

diff --git a/vitter.cpp b/vitter.cpp
index e14f700..1bcab25 100644
--- a/vitter.cpp
+++ b/vitter.cpp
@@ -355,7 +355,7 @@ namespace vitter {
*/

    void get_the_code(node **tree, unsigned char symbol, char *do_code, std::queue<char> *code_write) {
  •           char temp[strlen(do_code)+1];
    
  •           char temp[strlen(do_code)+2];
              if ((*tree)->symbol == symbol && (*tree)->left == NULL && (*tree)->right == NULL && (*tree)->weight != 0) {
                      for (int i=0; i<strlen(do_code); i++) {
                              (*code_write).push(do_code[i]);
    

@@ -378,7 +378,7 @@ namespace vitter {
}

    void get_nyt_code(node **tree, char *do_code, std::queue<char> *code_write) {
  •           char temp[strlen(do_code)+1];
    
  •           char temp[strlen(do_code)+2];
              if ((*tree)->weight == 0 && (*tree)->left == NULL && (*tree)->right == NULL) {
                      for (int i=0; i<strlen(do_code); i++) {
                              (*code_write).push(do_code[i]);
    

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.