|
|
|
@@ -114,7 +114,6 @@ struct Array_List { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void dealloc() { |
|
|
|
free(data); |
|
|
|
data = nullptr; |
|
|
|
@@ -124,6 +123,19 @@ struct Array_List { |
|
|
|
count = 0; |
|
|
|
} |
|
|
|
|
|
|
|
bool contains_linear_search(type elem) { |
|
|
|
for (u32 i = 0; i < count; ++i) { |
|
|
|
if (data[i] == elem) |
|
|
|
return true; |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
bool contains_binary_search(type elem) { |
|
|
|
return sorted_find(elem) != -1; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Array_List<type> clone() { |
|
|
|
Array_List<type> ret; |
|
|
|
ret.length = length; |
|
|
|
@@ -309,6 +321,14 @@ struct Queue { |
|
|
|
return arr_list.count - next_index; |
|
|
|
} |
|
|
|
|
|
|
|
bool contains(type elem) { |
|
|
|
for (u32 i = next_index; i < arr_list.count; ++i) { |
|
|
|
if (arr_list[i] == elem) |
|
|
|
return true; |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
void clear() { |
|
|
|
next_index = 0; |
|
|
|
arr_list.clear(); |
|
|
|
|