Skip to content

Instantly share code, notes, and snippets.

View ashishugi's full-sized avatar
🎯
FOCUS

Ashish Kumar Gupta ashishugi

🎯
FOCUS
  • India
View GitHub Profile
@ashishugi
ashishugi / Sort_HashMap.java
Created April 19, 2025 18:24
Sort HashMap wrt to its values
package com.dummy_java.dummy.demo.iv_set.iv;
import java.util.*;
public class Application {
public static HashMap<Integer, String> getSortedMap(HashMap<Integer, String> mp) {
List<Map.Entry<Integer, String>> list = new ArrayList<>(mp.entrySet());
Collections.sort(list, (Map.Entry<Integer, String> a, Map.Entry<Integer, String> b) -> {
return (a.getValue()).compareTo(b.getValue());
@ashishugi
ashishugi / System Design.md
Created October 7, 2024 17:54 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
package com.dummy_java.dummy;
import java.util.ArrayList;
import java.util.List;
public class DisjointSet {
List<Integer> parent = new ArrayList<>();
List<Integer> rank = new ArrayList<>();
List<Integer> size = new ArrayList<>();
class Trie {
public:
char ch;
bool isEnd;
Trie* child[26];
Trie(){
this->isEnd = false;
for(int i=0;i<26;i++) {
this->child[i] = NULL;
}
@ashishugi
ashishugi / Tries.cpp
Created January 28, 2022 17:21
Simple Implementation of tries
class TrieTree {
public:
char ch;
bool isEnd;
TrieTree* child[26];
TrieTree (){
isEnd = false;
for(int i=0;i<26;i++) {
this->child[i] = NULL;
}