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
#include <iostream> | |
#include <stdlib.h> | |
void insertion_sort(int *list, int lenght); | |
int main(int argc, char const *argv[]) | |
{ | |
int list_length = 30; | |
int list[list_length]; | |
srand(time(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
#include <iostream> | |
#include <stdlib.h> | |
void selection_sort(int *list, int list_length); | |
int main() | |
{ | |
int list_length = 30; | |
int list[list_length]; |
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 insertion_sort(arr): | |
for idx, number in enumerate(arr): | |
current = idx | |
previous = idx - 1 | |
if idx > 0: | |
while arr[current] < arr[previous] and (previous >= 0): | |
temp = arr[current] | |
arr[current] = arr[previous] | |
arr[previous] = temp | |
current = previous |
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
import random | |
def merge(left_arr, right_arr): | |
""" | |
Receives two ordered lists and returns a ordered | |
list created from the merge of the other two. | |
:param left_arr: ordered list | |
:param right_arr: ordered list | |
:return: ordered list created from the merge of left_arr and right_arr |
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
#include <iostream> | |
#include <stdlib.h> | |
#include <time.h> | |
int binary_search(int list[], int length, int to_be_found); | |
int recursive_binary_search(int list[], int to_be_found, int p, int r); | |
int main() | |
{ |
NewerOlder