-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e30e37
commit e736287
Showing
5 changed files
with
34 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include <stdbool.h> | ||
|
||
typedef struct node* bin_tree; | ||
|
||
struct node { | ||
int val; | ||
bin_tree left, right; | ||
}; | ||
|
||
bool is_ultraleftist(bin_tree t, int depth, int* depth_last) { | ||
if (!t) return true; | ||
|
||
if (!t->left && !t->right) { | ||
if (*depth_last < depth) | ||
return false; | ||
|
||
*depth_last = depth; | ||
return true; | ||
} | ||
|
||
return is_ultraleftist(t->left, depth + 1, depth_last) | ||
&& is_ultraleftist(t->right, depth + 1, depth_last); | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
typedef struct node* bin_tree; | ||
|
||
struct node { | ||
int val; | ||
bin_tree left, right; | ||
}; | ||
|
||
// policz rozmiar drzewa: int size | ||
|
||
// przejdź przez drzewo postorderem |
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
#include <stdlib.h> | ||
|
||
typedef struct bin_tree bin_tree; | ||
|
||
struct bin_tree { | ||
|