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
GS = -g | |
JC = javac | |
.SUFFIXES: .java .class | |
.java.class: | |
$(JC) $(JFLAGS) $*.java | |
CLASSES = \ | |
Server.java \ | |
Client.java \ |
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 <assert.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
typedef struct node_t | |
{ | |
int value; | |
struct node_t *next; | |
}node_t; |
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 <assert.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#ifndef QUEUE_H | |
#define INPUT_BUFFER_SIZE 100 | |
#define OP_QUEUE_ENQUEUE 0 | |
#define OP_QUEUE_DEQUEUE 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> | |
void bubbleSort(int arr[], int count) | |
{ | |
int i = count, j; | |
int temp; | |
while(i > 0) | |
{ | |
for(j = 0; j < i - 1; j++) |
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 <assert.h> | |
#include <stdlib.h> | |
#include <stdio.h> | |
#ifndef _BST_H | |
#define _BST_H | |
#define END 0 | |
#define INSERT 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
void * safe_malloc(size_t const size) | |
{ | |
void * p = malloc(size); | |
if (p == NULL) { | |
fprintf(stderr, "Out of memory\n"); | |
exit(1); | |
} | |
return p; |
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
//quick sort | |
#include<stdio.h> | |
void quicksort(int*arr,int left, int right); | |
int partition(int *arr,int left,int right); | |
int main() | |
{ | |
int arr[6]={5,4,1,2,8,3}; | |
int 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
/** Divide : Partition the array A[low....high] into two sub-arrays | |
* A[low....j-1] and A[j+1...high] such that each element | |
* of A[low....j-1] is less than or equal to A[j], which | |
* in turn is is less than or equal to A[j+1...high]. Compute | |
* the index j as part of this partitioning procedure. | |
* Conquer : Sort the two sub-arrays A[low....j-1] and A[j+1....high] | |
* by recursive calls to quicksort | |
**/ | |
#include<stdio.h> |
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
# ~/.osx — http://mths.be/osx | |
############################################################################### | |
# General UI/UX # | |
############################################################################### | |
# Set computer name (as done via System Preferences → Sharing) | |
scutil --set ComputerName "MacBookPro" | |
scutil --set HostName "MacBookPro" | |
scutil --set LocalHostName "MacBookPro" |
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
/* | |
* safe_malloc () | |
* | |
* Call calloc () and abort if the specified amount of memory cannot be | |
* allocated. | |
*/ | |
void * | |
safe_malloc(size_t size) | |
{ |
OlderNewer