Skip to content

rp-code9/programming

Repository files navigation

Table of Contents

  1. System Design Questions
  2. Java OOP Concepts
  3. C++ Concepts
  4. Operating System Concepts
  5. Reading-References
  6. Algorithms and Data Structures

Large scale system design and object oriented design questions and topics

  1. Keywords To Remember
  2. Infrastructure Design Questions
  3. System Design Questions
  4. Object Oriented Design Questions
  5. External References

Short sample programs to demonstrate the inbuilt object oriented concepts in Java language.

  • Generics
  • Equality
  • String Representation of Object
  • Hash code of Object
  • Dynamic array
  • Iterable
  • Comparable
  • assert
  • Comparator
  • Immutability

Short sample program to demonstrate C++ language basics

  • Smart pointers
  • move semantics
  • move constructor
  • move assignment
  • enums & enum class
  • Random numbers
  • Synchronization
    • Simple producer consumer with busy wait, mutex in C++ Link
    • Simple producer consumer with condition variable, condition variable in C++ Link
  • File IO
    • Print all lines which contain a given pattern Link
  • Memory Management
    • Implement aligned malloc() and free() Link
    • Implement malloc() and free() Link
  • Hash table implementation
    • Implement elementary hash table in C++ Link
    • Hash table implementation in C++ using STL Inspiration   Link

Reading-References

Algorithms and Data Structures

  1. Google CodeJam
  2. Algorithms
  3. LeetCode
  1. Google Code Jam 2018
  2. Google Code Jam 2020

Princeton Algorithms Course

Princeton Algorithms Part 1 and Part2

Comprehensive guides/wiki/articles/solutions/summary

  • A general approach to backtracking questions (Subsets, Permutations, Combination Sum) Link
  • A summary: how to use bit manipulation to solve problems easily and efficiently Link

Linked List

  • Rearrange odd even elements in a linked list. C++
  • Linked List Java
  • Alternating Split Java
  • Sort linked list
    • Simple method C++
    • Using merge sort C++
  • Clone list with random pointers C++
  • Linked List implementation
    • Push, append, delete, pop, clone list C

Stack

  • Dynamic Stack Java
  • StackOfStrings Java

Queue

Priority Queue and Heap

Binary Tree

  • Binary tree
    • Recursive Preorder, inorder, postorder, height, diameter C++
  • Construct balanced binary tree C++
  • Find longest increasing path in binary tree C++
  • Find longest increasing path in n-ary tree C++
  • Find next right node in binary tree C++
  • Count all possible distinct sums paths top-down in a binary tree. C++

Symbol table and Search Trees

  • Binary Search Tree
    • Java
    • Recursive insert, search, construct balanced tree C++
    • Iterative insert, search C++
  • Interval Search Tree Java C++

Union Find

  • Quick Find Java
  • Quick Union Java
  • Weighted Quick Union Java
  • Weighted Quick Union with Path compression Java
  • Percolation Problem Java

Graph

  • Find the celebrity in room. C++
  • Graph
    • Representation using STL, BFS, DFS C++

String

  • Parse decimal, hexdecimal, octal from a file and output to another. C++
  • Check if two strings are isomorphic. C++
  • Find first unique character in a string. C++
  • String sorting
    • Using trie data structure Java
  • Auto Completion search
  • English word meaning dictionary
  • Longest Common Prefix
  • Pattern Searching
    • Using trie of all suffix Java
  • Word Break problem
    • Using trie, recursive algorithm Java
  • KMP Pattern searching
    • Search pattern in text Java
  • Remove characters from a first string which are present in other string C   C++ <<<<<<< HEAD =======
  • Interleaved string
    • Print interleaved string of 2 strings C++
    • Find if a string is interleaved of two other strings C++

Add disjoint set and interleaved string

Trie

  • Spell checker. C++
  • Trie data structure. Java

Arrays, 2D arrays, matrices

  • Continuous ones Java
  • Infections over a distance Java
  • 8 Puzzle Java
  • Maximum sum rectangle in a 2D matrix C++

Sorting

  • Insertion sort (generic) Java C++
  • Selection sort (generic) Java
  • Shell sort (generic) Java
  • Merge sort (generic) Java C++
  • Bottom Up Merge (generic) Java
  • Quicksort (generic) Java C++
  • 3-way Quicksort (generic) Java
  • Dutch national flag problem C++
  • Merge intervals C++
  • Meeting rooms C++

Searching

  • Find peak element C++
  • Search in rotated array C++
  • Search in a 2D matrix C++
  • Find start and end of a range in a sorted array C++
  • Find kth largest element
    • Using min heap C++
    • Using max heap C++
    • Using STL iterator and algorithm C++
    • Using quick select algorithm C++
  • Binary Search

Dynamic Programming

  • Word Break problem
    • Recursive algorithm, using trie Java
  • Longest Common Subsequence
    • Naive, top-down, bottom up tabulation, LCS string, LCS of 3 strings Java
    • Naive recursion, top-down memoization, space optimized, bottom up tabulation C++
  • Shortest Common Supersequence
  • Longest Common Substring
    • Recursive, bottom-up, space optimized, print substring, without repeating characters Java
  • Longest Common Substring in array
    • Stem in an array of strings Java
  • Subsequence variants: Repeated Subsequence
    • top-down, naive recursion, print sequence Java
  • Levenshtein distance / Edit Distance Java
  • Largest sqaure submatrix of 1s Java
  • Min cost path from top right to bottom down in matrix Java
  • Maximum value of expression Java
  • Subset sum partition Java
  • Three Partition Java
  • Rod Cutting Java
  • Rod Cutting Product Java
  • Coin Change - Minimum number of coins
  • Coin Change Ways Java
  • Binary String with no consecutive 1s Java
  • Word Break Java
  • Word Break using trie Java
  • Array Adjustment cost Java
  • No of ways for dice throws Java
  • Wildcard Matching Java
  • Tripping Rain Water Java
  • Jump Game C++
  • Length of Longest Increasing Subsequence C++

Greedy

  • Activity Selection Java
  • Activity Sequencing
    • Naive algorithm Java
    • Using union-find Java

Maths, Stats, Ordered Stats

  • kth element, Quick Select Java
  • Shuffling : using Fisher–Yates shuffle algorithm     Java
  • GaussElimination : Gauss elimination or Gauss Jordan method to solve system of linear equations Java
  • Point2D : Data structure to represent point in 2D space Java
  • Point3D : Data structure to represent point in 3D space Java
  • Generate Nth row of Pascal triangle
  • Happy number Wiki C++
  • Excel Sheet Column Number C++
  • Number of zeros in facorial C++
  • Implement power function C++
  • Implement square root function C++

Permutation

  • Permutation of objects Java
  • Unique paths C++

Encoding decoding (char, int, digits etc)

  • Print all possible decoding of given digit sequence. C++
  • Print all possible decoding of given digit sequence. C++

Other data structures/ Implement some data structure

  • Find the celebrity in room. C++
  • Maximum possible length by cutting N wood pieces into K pieces. C++
  • Merge N trasactions preserve order. C++
  • Stock Buy Sell to Maximize Profit. C++
  • Find majority element. Problem
  • CPU task scheduling C++
  • Activity/Task : representation of an activity or a task Java
  • Randomized set Problem C++
  • Disjoint set
    • Naive implementation C++
    • Path compression, union by rank C++

Bit manipulation/ Bitwise hacks

Computational Geometry

  • Closest pair of points : Divide and conquer algorithm Java
  • Collinear points Java
  • Group points which are at distance less than k : brute force algorithm Java
  • Group points which are at distance less than k : divide and conquer algorithm Java

Random data generation

  • Random String : generate random string Java
  • Random 2D Matrix : generate random 2D boolean, binary or integer matrix Java

Leetcode

Array

  • Running sum   Problem
    • using loop, using partial sum, using accumulate C++

Maths

  • Top K frequent elements     Problem
    • Using hashmap and sorting C++
    • Using hashmap and priority queue C++
    • Using Quick Select C++

String

Singly Linked List

  • Delete Node (without previous)     Problem
    • Simple Delete C++
  • Remove Nth from end     Problem
    • Simple Delete C++
  • Reverse a linked list     Problem
  • Merge two sorted     Problem
  • Palindrome List     Problem
    • Double Reverse C++
  • Cycle in Linked List     Problem
    • Slow and fast pointer C++
  • Sum two numbers     Problem
  • Odd Even Linked List     Problem
  • Intersection of Two Linked Lists     Problem
    • Difference of Lengths C++
    • Traversal Pointer reassignment C++

Binary Tree

  • Max depth     Problem
    • Max Depth C++
  • Validate Binary search Tree     Problem
    • Validate BST C++
  • Symmeric Binary Tree     Problem
  • Level Order Of Tree     Problem
    • Using queue C++
  • Sorted Array to Binary Search Tree     Problem
    • Recursive C++
  • Inorder traversal     Problem
    • Iterative using stack C++
    • Recursive C++
  • Zigzag/spiral level order traversal     Problem
  • Construct Binary Tree from Preorder and Inorder Traversal     Problem
  • Populating Next Right Pointers in Each Node Problem
    • Iterative level order C++
    • Using queue C++
  • Kth Smallest Element in a BST     Problem
    • Iterative using stack C++
    • Recursive C++
  • Kth Largest Element in a BST | ?? | ? |
    • Iterative using stack C++
    • Recursive C++
  • Number of Islands     Problem
    • Using DFS C++
    • Using BFS C++
    • Using disjoint set C++

Permutations

  • Letter Combinations of a Phone Number     Problem
  • Generate Balanced Parentheses     Problem
    • Recursive C++

Backtracking

  • Permutations     Problem
    • Backtracking C++
  • Subset     Problem
    • Backtracking C++
  • Subset without duplicates     Problem
    • Backtracking C++
  • Combination Sum     Problem
    • Backtracking C++
  • Combination Sum without duplicates     Problem
    • Backtracking C++
  • Word Search | Link
    • Not working, Recursive DFS C++