-
-
Notifications
You must be signed in to change notification settings - Fork 360
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
Adding missing examples for Tree Traversal and FFT in C. #109
Conversation
There was a problem hiding this 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) { |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
chapters/FFT/code/c/fft.c
Outdated
} | ||
for (unsigned int i = 0; i < N; ++i) { | ||
b = i; | ||
b = (((b & 0xaaaaaaaa) >> 1) | ((b & 0x55555555) << 1)); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
chapters/FFT/code/c/fft.c
Outdated
} | ||
} | ||
|
||
for (size_t i = 0; i < N; ++i) { |
There was a problem hiding this comment.
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
There was a problem hiding this 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
No description provided.