Skip to content

Instantly share code, notes, and snippets.

View Kinjalrk2k's full-sized avatar
🥱
Bored? Code!

Kinjal Raykarmakar Kinjalrk2k

🥱
Bored? Code!
View GitHub Profile
#include <stdio.h>
#include <math.h>
struct point
{
double x, y, z;
};
int main()
{
@Kinjalrk2k
Kinjalrk2k / MSB_optimization.c
Last active September 15, 2018 05:57
The Maze Solving Bot algorithms/approach (both Dry run and Actual Run), which in turn to be applied into an Arduino Sketch for the TechnoRion Techfest '18 at IIT Bombay
/***********************TEST CASES***************************/
char ac_path[100]="LULLLUSULLUSLL";
int ac_path_len=14;
/***********************************************************/
char opt_path[100]; // save the moves of optimised path
int opt_path_len; // optimised path lenght
/* Did You Know? opt_path_len<=ac_path_len */
// function that checks whether the path is optimisable... meanwhile optimises it
@Kinjalrk2k
Kinjalrk2k / ms.c
Created February 12, 2019 16:38
merge sort
#include <stdio.h>
#include <malloc.h>
void print(int arr[], int size)
{
int i;
for (i=0; i < size; i++)
printf("%d, ", arr[i]);
printf("\b\b \b\b\n");
}
@Kinjalrk2k
Kinjalrk2k / EvalPostfix.c
Last active March 30, 2019 15:57
This piece of code evaluates an post-fix expression using Stack. Highly undocumented! Ask if in Doubt!
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <math.h>
struct node{
float data;
struct node *next;
};
#include <stdio.h>
void swap(int *xp, int *yp)
{
int temp = *xp;
*xp = *yp;
*yp = temp;
}
void selectionSort(int arr[], int n)
#include<stdio.h>
#include <string.h>
int main()
{
int i, j, n;
char str[100][50], temp[50];
printf("Enter the no. of words");
scanf("%d", &n);
@Kinjalrk2k
Kinjalrk2k / evaluate_postfix.c
Last active April 17, 2019 10:49
This program evaluates a postfix expression and returns a result!
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#include <math.h>
struct node{
float data;
struct node *next;
};
@Kinjalrk2k
Kinjalrk2k / freqofword.c
Created April 23, 2019 08:01
Frequency of a word in a sentence using 2D character array
#include <stdio.h>
#include <string.h>
int main(int argc, char const *argv[])
{
char sentence[100][100], search_word[100];
int no_of_words = 0, freq = 0;
printf("Enter the no of words: "); // user prompt for:
scanf("%d", &no_of_words); // total no. of words in the sentence
int binary_search_DLL()
{
sorting(); // 'cause binary search is possible in sorted list only
int search_key;
printf("\n\nEnter the element : "); // user promt for
scanf("%d",&search_key); // searching element
struct node *ptr, *lptr, *rptr, *midptr;
lptr = header; // left end of the working list, initially header
@Kinjalrk2k
Kinjalrk2k / scll.c
Last active July 19, 2019 15:06
Single Circular Linked List (Week2) (C Lab)
#include <stdio.h>
#include <malloc.h>
typedef struct Node{
int data;
struct Node* next;
}node; // nickname :)
node* createCircularList()
{