Skip to content

Instantly share code, notes, and snippets.

View anubhavshrimal's full-sized avatar
🎯
Focusing

Anubhav Shrimal anubhavshrimal

🎯
Focusing
View GitHub Profile
@anubhavshrimal
anubhavshrimal / QuickSortPivotLast.c
Created March 1, 2016 20:18
quick sort an array using pivot as last element
#include <stdio.h>
#include <stdlib.h>
#define max 10001
void quickSort(int a[],int l,int r);
int partition(int a[],int l,int r);
//main function definition
int main()
{
@anubhavshrimal
anubhavshrimal / QuickSortPivotFirst.c
Created March 1, 2016 20:19
quick sort an array using pivot as first element of the array
#include <stdio.h>
#include <stdlib.h>
#define max 10001
void quickSort(int a[],int l,int r,int *count);
int partition(int a[],int l,int r);
//main function definition
int main()
{
@anubhavshrimal
anubhavshrimal / MergeSort.c
Last active April 10, 2016 06:46
perform merge sort operation based on divide and conquer algorithm
#include <stdio.h>
#include <stdlib.h>
#define max 30
void mergeSplit(int a[],int l,int n);
void mergeSort(int a[],int l,int mid,int n);
int main()
{
int n;
@anubhavshrimal
anubhavshrimal / HeapSort.c
Created March 1, 2016 20:20
to sort a given array using heap sort method
#include <stdio.h>
#define max 30
void build_MaxHeap(int a[],int arraySize);
void max_Heapify(int a[],int i,int heapSize);
void heapSort(int a[],int arraySize);
void swap(int a[],int i,int largest);
int main()
{
@anubhavshrimal
anubhavshrimal / .gitignore
Created March 8, 2016 18:57 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@anubhavshrimal
anubhavshrimal / RadixSort.java
Created March 23, 2016 14:57
performs sorting of an array using RadixSort Algorithm in O(n) time complexity
import java.util.Scanner;
public class RadixSort
{
//method returns number of digits in the maximum element of the array
private int getMaxDigits(int a[],int size)
{
int max=a[0];
for(int i=1;i<size;i++) //find the maximum element in the array
{
@anubhavshrimal
anubhavshrimal / CountingSort.java
Created March 23, 2016 18:50
performs sorting of an integer array using counting sort algorithm in O(n) time complexity
import java.util.Scanner;
public class CountingSort
{
//method to get the maximum element from the array
private int getMax(int a[],int size)
{
int max=a[0];
for (int i = 1; i < size; i++)
{
@anubhavshrimal
anubhavshrimal / CountryCodes.json
Last active July 14, 2025 19:05 — forked from Goles/CountryCodes.json
Country and Dial or Phone codes in JSON format
[
{
"name": "Afghanistan",
"dial_code": "+93",
"code": "AF"
},
{
"name": "Aland Islands",
"dial_code": "+358",
"code": "AX"
@anubhavshrimal
anubhavshrimal / Indian_Cities_In_States_JSON
Created March 31, 2017 09:56
JSON of Indian Cities in each of the 29 Indian States
{
"Andaman and Nicobar Islands": [
"Port Blair"
],
"Haryana": [
"Faridabad",
"Gurgaon",
"Hisar",
"Rohtak",
"Panipat",
@anubhavshrimal
anubhavshrimal / hello.c
Created July 11, 2018 17:38
linux kernel hello.c
#include <linux/kernel.h>
asmlinkage long sys_hello(void)
{
printk("Hello world\n");
return 0;
}