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 <stdio.h> | |
| #include <stdlib.h> | |
| #define HEAP_SIZE 10 | |
| //building a min-heap | |
| typedef struct heap{ | |
| int data[HEAP_SIZE + 1]; //the body of the heap | |
| int total_elements; //the current number of elements in the heap | |
| }heap; |
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 <stdio.h> | |
| #include <stdlib.h> | |
| typedef struct node { | |
| int data; | |
| struct node *next; | |
| } node; | |
| void insert_node(node **head, int x){ | |
| node *new_node = malloc(sizeof(node)); |
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
| //STANDARD BST IMPLEMENTATION | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| typedef struct node{ | |
| int data; | |
| struct node *parent; | |
| struct node *left; | |
| struct node *right; | |
| }node; |
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 <stdio.h> | |
| //swap two values in an integer array | |
| void swap(int arr[], int index_one, int index_two){ | |
| int temp = arr[index_one]; | |
| arr[index_one] = arr[index_two]; | |
| arr[index_two] = temp; | |
| } | |
| //partition the array using a given pivot |