Skip to content

Instantly share code, notes, and snippets.

View vslala's full-sized avatar

Varun Shrivastava vslala

View GitHub Profile

Trie Data Structure

It is a symbol table specialized to string keys.

The goal is to device a data structure that is Faster than hashing and More flexible than BSTs.

Challenge - Efficient Performance for String keys

R-Way Trie

@vslala
vslala / modified_kaprekar_number.cpp
Created October 28, 2020 05:50
Modified Kaprekar Number - Hacker rank problem
#include<iostream>
using namespace std;
int low;
int hi;
void test_cases() {
cin >> low; cin.ignore();
cin >> hi; cin.ignore();
@vslala
vslala / SortingAlgorithmComparision.java
Created May 28, 2020 19:00
Multi-threaded Code for generating time-complexity of elementary sorting algorithms
import com.bma.algorithms.sort.elementary.Util;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Random;
@vslala
vslala / gitlab-ci.yml
Created May 27, 2020 16:53
Step by step commands to ssh into vps and fire commands
stages:
- sshserver
variables:
REGISTRY_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
test:
image: alpine:latest
stage: sshserver
script:
@vslala
vslala / application.properties
Created May 22, 2020 13:08
Configuration for running integration tests with H2 Database, Flyway, Spring Boot JPA
# Datasource configuration for jdbc h2
# this is for file based persistent storage
# spring.datasource.url=jdbc:h2:file:/data/demo
# For in-memory storage
spring.datasource.url=jdbc:h2:mem:testdb;MODE=MySQL;DB_CLOSE_DELAY=-1;IGNORECASE=TRUE;
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=vslala
spring.datasource.password=simplepass
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
@vslala
vslala / Brewfile
Last active February 14, 2021 08:32
Updated frequently
brew "asdf"
brew "adr-tools"
brew "curl"
brew "diff-so-fancy"
brew "direnv"
brew "ffmpeg"
brew "git"
brew "git-secret"
brew "gnu-sed"
brew "gpg"
@vslala
vslala / App.js
Created July 6, 2019 14:08
App - The main file that bootstraps the entire hello world react application with redux
import React from 'react';
import logo from './logo.svg';
import './App.css';
import HelloWorld from './components/HelloWorld';
import { Provider } from 'react-redux';
import store from './store';
import ButtonGroup from './components/ButtonGroup';
function App() {
return (
@vslala
vslala / HelloWorld.js
Created July 6, 2019 14:06
Hellow World component for hello world application
import React, {useState} from "react";
import { useSelector } from 'react-redux';
export default function HelloWorld() {
const tech = useSelector(state => state.tech);
return (
<h1>
Say Hello To: {tech}
@vslala
vslala / ButtonGroup.js
Created July 6, 2019 14:05
ButtonGroup react component to render buttons
import React from "react";
import "../../actions";
import setTechnology from "../../actions";
import store from '../../store';
export default function ButtonGroup({technologies = []}) {
const dispatchAction = (e) => {
const tech = e.target.dataset.tech;
console.log("Tech: " + tech);
import * as Type from '../actions/constants';
export default (state, action) => {
console.log(action);
if (action.type === Type.SET_TECHNOLOGY) {
return {
...state,
tech: action.text