Skip to content

Instantly share code, notes, and snippets.

View sychonet's full-sized avatar

Abhay Joshi sychonet

View GitHub Profile
@sychonet
sychonet / instructions.txt
Last active February 12, 2023 19:08
MongoDB setup for testing query in TIX-NOTIFICATION-SETTING
Run following commands in sequence:
docker network create notification-setting-mongo-network
docker run -d --network notification-setting-mongo-network --name notification-setting-mongo \
-e MONGO_INITDB_ROOT_USERNAME=admin \
-e MONGO_INITDB_ROOT_PASSWORD=abc1234 \
mongo:latest
docker run -it --rm --network notification-setting-mongo-network mongo \
@sychonet
sychonet / leetcode_wallsAndGates.go
Created June 12, 2022 03:06
A solution for problem walls and gates on leetcode in Solang
// A solution for walls and gates problem on leetcode in golang
package main
import (
"fmt"
"math"
)
const EMPTY int = math.MaxInt32
const GATE int = 0
@sychonet
sychonet / noRepeatBFS.txt
Created June 10, 2022 08:46
Pseudocode for BFS where we don't visit a node twice
/**
* Return the length of the shortest path between root and target node.
*/
int BFS(Node root, Node target) {
Queue<Node> queue; // store all nodes which are waiting to be processed
Set<Node> visited; // store all the nodes that we've visited
int step = 0; // number of steps neeeded from root to current node
// initialize
add root to queue;
add root to visited;
@sychonet
sychonet / basicBFS.txt
Last active June 10, 2022 08:47
Pseudocode for basic BFS (Breadth First Search)
/**
* Return the length of the shortest path between root and target node.
*/
int BFS(Node root, Node target) {
Queue<Node> queue; // store all nodes which are waiting to be processed
int step = 0; // number of steps neeeded from root to current node
// initialize
add root to queue;
// BFS
while (queue is not empty) {
@sychonet
sychonet / basicCircularQueue.go
Last active June 10, 2022 07:04
A basic implementation of circular queue in Golang
// Implementation of circular queue
package main
import "fmt"
type MyCircularQueue struct {
data []int
head int
tail int
size int
@sychonet
sychonet / queueBasic.go
Last active June 9, 2022 11:04
A very basic implementation of queue in Golang
// Basic implementation for queue
package main
import "fmt"
type queue struct {
data []int
head int
}
@sychonet
sychonet / minheap.go
Created June 4, 2022 08:28
Implementation of min heap in Golang
// Min Heap implementation
// We will be performing following operations on the min heap
// a) Add a new element (add)
// b) Fetch top element (peek)
// c) Delete top element (pop)
package main
import "fmt"
type minHeap struct {
@sychonet
sychonet / maxheap.go
Last active June 4, 2022 08:27
Implementation of max heap in Golang
// Max Heap implementation
// We will be performing following operations on the max heap
// a) Add a new element (add)
// b) Fetch top element (peek)
// c) Delete top element (pop)
package main
import "fmt"
type maxHeap struct {