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
| class Node{ | |
| int data; | |
| Node left; | |
| Node right; | |
| Node(int dat) | |
| { | |
| data = dat; | |
| left = right = 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
| class Node: | |
| def __init__(self, data): | |
| self.data = data | |
| self.left = None | |
| self.right = None |
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
| class Node{ | |
| constructor(data){ | |
| this.data = data; | |
| this.left; | |
| this.righ; | |
| } | |
| insert(data){ | |
| if (this.data != null){ | |
| if (data < this.data){ |
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
| class Node: | |
| def __init__(self, data): | |
| self.data = data | |
| self.left = None | |
| self.right = None | |
| def insert(self, data): | |
| if self.data: | |
| if data < self.data: | |
| if self.left is None: |
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
| class Node{ | |
| int data; | |
| Node left; | |
| Node right; | |
| Node(int dat) | |
| { | |
| data = dat; | |
| left = right = 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
| function find_min_max(array, low, high){ | |
| var max_val; | |
| var min_val; | |
| if (low == high){ | |
| max_val = array[low]; | |
| min_val = array[low]; | |
| } | |
| else if(low+1 == high){ | |
| if (array[low] > array[high]){ | |
| max_val = array[low]; |
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
| class MinMax { | |
| int min; | |
| int max; | |
| MinMax(int min, int max) | |
| { | |
| min = min; | |
| max = max; | |
| } | |
| } | |
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
| def find_min_max(array, low, high): | |
| arr_min = array[low] | |
| arr_max = array[high] | |
| if low == high: | |
| arr_max = arr_min = array[low] | |
| elif low == high + 1: | |
| max_val, min_val = (array[0], array[1]) if array[0] > array[1] else (array[1], array[0]) | |
| else: |
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
| function find_max_min(array){ | |
| var max_val; | |
| var min_val; | |
| if (array.length == 1){ | |
| max_val = array[0]; | |
| min_val = array[0]; | |
| } | |
| else if(array.length > 1){ | |
| if (array[0] > array[1]){ | |
| max_val = array[0]; |
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
| class MinMax { | |
| int min; | |
| int max; | |
| MinMax(int min, int max) | |
| { | |
| min = min; | |
| max = max; | |
| } | |
| } | |