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
// | |
// Created by gunavaran on 6/2/21. | |
// | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <pthread.h> | |
#define NUM_THREADS 4 | |
#define NUM_ITERATIONS 1000000000 |
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
// Created by gunavaran on 3/9/21. | |
//Acknowledgement: The functions for all the sorting algorithms are extracted from | |
//https://www.geeksforgeeks.org/selection-sort/ | |
//https://www.geeksforgeeks.org/insertion-sort/ | |
//https://www.geeksforgeeks.org/bubble-sort/ | |
#include <stdio.h> | |
#include <stdbool.h> | |
#include <stdlib.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
// Acknowledgement: https://www.geeksforgeeks.org/bubble-sort/ | |
// Implementation of Bubble sort | |
#include <stdio.h> | |
void swap(int *xp, int *yp) | |
{ | |
int temp = *xp; | |
*xp = *yp; | |
*yp = temp; | |
} |
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
// Acknowledgement: https://www.geeksforgeeks.org/insertion-sort/ | |
// C program for insertion sort | |
#include <math.h> | |
#include <stdio.h> | |
/* Function to sort an array using insertion sort*/ | |
void insertionSort(int arr[], int n) | |
{ | |
int i, key, j; | |
for (i = 1; 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
// Acknowledgement: https://www.geeksforgeeks.org/selection-sort/ | |
// C program for implementation of selection sort | |
#include <stdio.h> | |
void swap(int *xp, int *yp) | |
{ | |
int temp = *xp; | |
*xp = *yp; | |
*yp = temp; | |
} |
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
#acknowledgement: https://brilliant.org/wiki/karatsuba-algorithm/ | |
from math import ceil, floor | |
#math.ceil(x) Return the ceiling of x as a float, the smallest integer value greater than or equal to x. | |
#math.floor(x) Return the floor of x as a float, the largest integer value less than or equal to x. | |
def karatsuba(x,y): | |
#base case | |
if x < 10 and y < 10: # in other words, if x and y are single digits | |
return x*y |
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
// | |
// Created by gunavaran on 12/8/20. | |
// | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <time.h> | |
#include <pthread.h> | |
#define n 1024 |
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
// | |
// Created by gunavaran on 12/8/20. | |
// | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <time.h> | |
#define n 1024 | |
#define s 512 |
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
import java.util.Random; | |
public class MatrixMultiplication { | |
static int n = 1024; | |
static double[][] A = new double[n][n]; | |
static double[][] B = new double[n][n]; | |
static double[][] C = new double[n][n]; | |
public static void main(String[] args) { |
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 <stdint.h> | |
#include <stdbool.h> | |
bool overflow(int64_t *A, size_t n) { | |
//All elements of A are non-negative | |
A[n] = INT64_MAX; | |
A[n + 1] = 1; //any positive value | |
size_t i = 0; | |
int64_t sum = A[0]; |
NewerOlder