This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tree_node* binary_search(tree_node* n, int value) | |
{ | |
if (n == NULL) | |
{ | |
return NULL; | |
} | |
tree_node* x = n; | |
while (x != NULL) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tree_node* binary_search(tree_node* n, int value) | |
{ | |
if (n == NULL) | |
{ | |
return NULL; | |
} | |
if (value == n->data) | |
{ | |
return n; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// (1) C++: - Defining a dictionary [key type=string, value type=int] | |
// - No easy way to initialize. | |
// | |
map<string, int> dict; | |
// | |
// (1`) C++11: Defining and initializing a dictionary [key type=string, value type=int] | |
// | |
map<string, int> dict | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// (1) C#: Defining an initializing a dictionary [key type=string, value type=int] | |
// | |
Dictionary<string, int> dict = new Dictionary<string, int>() | |
{ | |
{"Eve", 101}, | |
{"George", 150}, | |
{"Emma", 200} | |
}; | |
// |
NewerOlder