Height of a Binary Tree: Recursion Unrolled & Explained

— tags: >- development, C++, tree, height, programming, recursion, internals, complete flow categories: development — Height of a Binary Tree is the longest path in the tree. Code int getHeight(node *root) { if (root == NULL) { return -1; } int leftHeight = getHeight(root->left); int rightHeight = getHeight(root->right); return (max(leftHeight, rightHeight) + 1); } Suppose … More Height of a Binary Tree: Recursion Unrolled & Explained

File system in userspace (FUSE) on Linux : C implementation

BBFS is a good starting point to develop a file system in C Application should keep in mind file offset before issuing a request. A write should be followed with a seek to offset zero, before issuing read. FUSE 2.7 reads 8K data by default, in two 4K chunks Read happens in last 4K and … More File system in userspace (FUSE) on Linux : C implementation

Forward declaration of a structure in C

What do you think of following code? /* * decl.h */ struct junk { int a; }; ———————————————- /* * fwd.c * We have not included the header file decl.h. */ #include struct junk; int main() { struct junk *ptr; printf(“%d”, ptr->a); } You will get compilation error that structure object ptr is incomplete. This … More Forward declaration of a structure in C