Skip to content

Adding missing examples for Tree Traversal and FFT in C. #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
May 20, 2018

Conversation

Gathros
Copy link
Contributor

@Gathros Gathros commented May 13, 2018

No description provided.

@Gathros Gathros added Implementation Edit This provides an edit to an algorithm implementation. (Code and maybe md files are edited.) Chapter Edit This changes the archive's chapters. (md files are edited.) labels May 13, 2018
Copy link
Member

@leios leios left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good change, just a few nitpicks.

printf("%d\n", n.id);
}

void dfs_recursive_inorder_btree(node n) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function has a case for the number of children from 0-2; however, what about the cases when n>2?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's in the default case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry. I kinda forgot that this section only works on binary trees.

}
for (unsigned int i = 0; i < N; ++i) {
b = i;
b = (((b & 0xaaaaaaaa) >> 1) | ((b & 0x55555555) << 1));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are updating this code, would it be possible to leave a quick comment on what is happening here? This is probably quite confusing to new folks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha yeah, it looks like black magic to me :)

//DFS_stack(root);
//BFS_queue(root);
dfs_recursive(root);
//dfs_stack(root);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I comment out unnecessary functions with my julia code too, but I wonder if there is a better way of doing it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll just remove the comments then.

}
}

for (size_t i = 0; i < N; ++i) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a memcpy

Copy link
Contributor

@zsparal zsparal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@zsparal zsparal merged commit 90646a5 into algorithm-archivists:master May 20, 2018
@Gathros Gathros deleted the missingexamples branch May 20, 2018 08:13
@june128 june128 removed the Chapter Edit This changes the archive's chapters. (md files are edited.) label Jun 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Implementation Edit This provides an edit to an algorithm implementation. (Code and maybe md files are edited.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants