Skip to content

Instantly share code, notes, and snippets.

View Abhey's full-sized avatar
:octocat:
Working From Home

Abhey Rana Abhey

:octocat:
Working From Home
View GitHub Profile
@Abhey
Abhey / KnightTourProblem.cpp
Created December 20, 2017 13:01
Solution to classic Knight tour problem.
#include <bits/stdc++.h>
using namespace std;
int n;
int dx[] = {1, 1, -1, -1, -2, 2, -2, 2};
int dy[] = {-2, 2, -2, 2, 1, 1, -1, -1};
// Function for checking if the move is valid or not .............
@Abhey
Abhey / DynamicMaxOnesMatrixSize.cpp
Created December 10, 2017 10:33
Dynamic programming implementation of maximum size square sub-matrix with all 1's
#include <bits/stdc++.h>
using namespace std;
int findMaxOnesMatrixSize(vector<vector<int> > &matrix){
int n = matrix.size();
int m = matrix[0].size();
// Initializing dp matrix with 0 ........
vector<vector<int> > dp(n, vector<int>(m,0));
@Abhey
Abhey / NaiveMaxOnesMatrixSize.cpp
Created December 10, 2017 10:32
Naive implementation of maximum size square sub-matrix with all 1's
#include <bits/stdc++.h>
using namespace std;
int findMaxOnesMatrixSize(vector<vector<int> > &matrix){
int n = matrix.size();
int m = matrix[0].size();
int maxOnesMatrixSize = 0;
@Abhey
Abhey / Iterative Edit Distance.cpp
Created December 6, 2017 05:33
Iterative implementation of edit distance problem.
/*
Program Name - Edit Distance
Author Name - Abhey Rana
Date - 5 December 2017
*/
#include <bits/stdc++.h>
using namespace std;
int solveEditDistance(string str1, string str2){
@Abhey
Abhey / Recusive Edit Distance.cpp
Last active December 6, 2017 05:29
Naive recursive implementation of edit distance problem.
/*
Program Name - Edit Distance
Author Name - Abhey Rana
Date - 6 December 2017
*/
#include <bits/stdc++.h>
using namespace std;
int len1,len2;
@Abhey
Abhey / Simple Client.c
Last active March 31, 2024 13:38
Simple client server chat system in C
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <pthread.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
int main(){
@Abhey
Abhey / @Multiple Client Chat Description
Last active March 6, 2024 13:36
Multiple client chat system in C
It is an simple implementation of simple client server chat system where once client are connected to server,
then they can communicate with each other.
The client first needs to connect with the server and can then issue two commands -
1. GET - This command fetches the list of client's that are currently connected to server.
2. SEND (client number) (message) - SEND followed by client number which can be be used to send the meassage
to particular to that particular client number.
(please issue the complete send command in one go).
To run these program first run ChatServer.c and then run multiple instatnces of ChatServer.c .