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
/** AVL (auto-balanced BST) | |
-------- | |
Edit: keyType | |
-------- | |
Rewrite: MAX function, Traversal Print | |
**/ | |
#include<stdlib.h> | |
// Edit // typedef ... keyType; | |
// An AVL tree node // |
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
/** | |
String Pattern Matching: | |
1, Brute Force Matching | |
2, Boyer Moore Matching | |
3, KMP Matching | |
* * * * * * * * * * * * * | |
T: string size n | |
P: pattern size m | |
* * * * * * * * * * * * * | |
**/ |
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
/** Sorting: Insertion & Bubble & Selection | |
(Ascending ver.) | |
[Update 08.13.15]: Quick Sort + Merge Sort | |
- - - | |
Note: use for compare numbers or chars (rewrite for compare strings) | |
**/ | |
/*** Edit */// | |
typedef struct | |
{ |
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
/** | |
Heap Sort | |
* * * * * | |
A heap sort is a complete binary tree so: | |
// (index) left child = 2 * parent, | |
// (index) right child = 2 * parent + 1; | |
* * * * * | |
Note: heap uses 1-base index: [1 ... n] | |
// so list index k would be list[k - 1] | |
* * * * * |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
#include "stack_list.h" | |
stack_t *Initialize() | |
{ | |
stack_t *top = NULL; | |
return top; | |
} |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <ctype.h> | |
#include "stack_list.h" | |
/* Check if stacks holding numbers are all empty */ | |
int AllEmpty(stack_t **stack, int n) | |
{ | |
int i; | |
for(i = 0; i < n; i++) { |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include "stack_array.h" | |
void Initialize() | |
{ | |
top = 0; | |
} | |
int Empty() |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include "stack_structure.h" | |
void Initialize(stack_t *stack) | |
{ | |
stack->top = 0; | |
} | |
// Note: stack is a structure, so if I want to | |
// change it, i must point to it |
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
#ifndef DLL_H | |
#define DLL_H | |
#include<stdlib.h> | |
typedef ... data_t; | |
/* Node of a DLL */ | |
typedef struct DLLNode | |
{ |
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
/** Singly Linked List (include Sort Ascending) | |
insert, remove, add, count source code | |
**/ | |
#ifndef SLL_H | |
#define SLL_H | |
typedef ... data_t; | |
struct node |
OlderNewer