Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Let's Go!
//g++ 7.4.0 #include <iostream> #include <iostream> #include <queue> using namespace std; struct Node{ struct Node* left; struct Node* right; uint64_t data; }; // insertion function - ***design must not be recursive*** // Perform no action if value exists in tree. // if value is already present, return existing pointer to node with value. // Return ptr to new node. // lesser values on left // greater values on right // Balancing of tree is not desired in this implementation. struct Node* insertToTree(uint64_t value, struct Node* top) { return NULL; } // remove function // remove Node from tree for given value, and return pointer to Node structure (caller will manage memory) // return null otherwise // major flaw in API, please correct before proceeding! (more critical than implementation!) struct Node* removeFromTree(uint64_t value, struct Node* top) { return NULL; } // traverse function // simple take a top node, and dump all values in tree void traverseAndDump(struct Node* top) { return; } // Example tree // 12 // / \ // 8 18 // / \ // / \ // 5 10 // / \ // / \ // / \ // 9 11 // COnstruct a driver to recreate the tree, using the functions you developed above. int main(void) { printf("Hello, world!\n"); return 0; }
run
|
edit
|
history
|
help
0
Stock buy/sell, maximum subarray problem
Gauss op
find first non repeating
Spejmer
Date n Time Macros
Guess Number
copy_if c++98
Area of a triangle using templete
Vowel_check
PriorQ