DATA STRUCTURES & ALGORITHMS
Resources and Solutions
^_^
I have compiled many useful links for Data Structures and Algorithms questions and their solutions.
I have also listed the Theory Subjects, which are often ignored by students but one must have a vast knowledge of them to help them in their interviews.
I have also included the Placement Ready Roadmap, from beginner level -> interview-ready candidate
Table of Contents
- DATA STRUCTURES & ALGORITHMS - Table of Contents
๐ Roadmap to Dream Placement
1๏ธโฃ 100+ Top Product Based Companies
People only chase after FAANG, because that's what is hyped up but now there are a lot of companies which:
Good opportunities to enhance oneself
Pay Exceptionally Well
Good Work Life
Great Projects/Learning
Check their names here, and decide where you want to land.
2๏ธโฃ Language, Data Structures, CP
- Guide to how to start coding if you have zero knowledge about this field
- Only way to become good at something is to practice, an expert was once a newbie too ;)
- Only consistency matters, coding once a week for 10 hours is not beneficial, rather coding 1 hour each day will benefit you more.
- Reading/Learning/Practice resources are also listed below
Language
- Intent
- Familiarity with Syntax
- Familiarity with all keywords & Basic Concepts
- main focus is on, that are you comfortable in writing code with your preferred language
- Choices
- C++
- References:
- Time Required:
- 1-2 weeks
- 1-2 hrs/day
- Java
- References:
- Time Required: same as above
- Python
- References:
- Time Required: same as above
- Important Callout: Some companies don't allow python as a choice in their online coding test, so prepare accordingly
- C++
Data Structure and Algorithms
- Without this, No Software Engineering Interview, in a tech giant can be cracked
- Follow the DSA Crack Sheet List given below
- Time Required:
- 2-3 months
- 6-8 questions/day
- 3-6 hrs/day
Projects
- You need some projects to showcase your skills to your interviewer
- Choices:
- Mobile Development
- Web Development
- Machine Learning
- Some other stuff (like Blockchain, IoT, etc.)
- Time Required: 3 months (doing on weekends 6-8 hours)
- Choices:
Subjectve Topics
- Do a Subsequent reading, revision any day you get time
- Operating System
- OOPS, Object Oriented Skills
- DBMS, Databse Management
- Computer Networking
Competitive Programming
- CP needs time, it's not something that you can master in 2 months, We will get comfortable with online platforms and get a taste of competitive programming
- Leetcode questions nearly 150-200 questions
- Category:
- Easy: 30%
- Medium: 50%
- Hard: 20%
- Category:
- If time allows then go for Codeforces div2 Level A, B and C question
- Time Required:
- 150-200 Questions
- 2 months
- 3-4 Ques/day
System Design
- Tech Level:
- System's overview like we will use this queue with DynamoDB and a scheduler with a justification of why we are using this DB, SQS, SNS, multithreading, etc.
- for SDE-1 equivalent positions, this level is somewhat rare
- Normal Understanding:
- knowledge of dividing system & creating a rough DFD of system
- knowledge of DB Schema creation
- able to create problem-solving logic or not
- Time Required: Just need some reading of articles/notes, can be pursued parallelly
- Great Resources:
Misc Stuff
- Aptitude/Reasoning
- Do some mock tests to gain confidence
- Basic Programming MCQ
- C/C++/Java/Python fundamentals
- Print output type questions
- Time/space complexity Questions
- SQL Queries
- Puzzles
- Always go through 50-60 interview experiences before interview
๐ DSA Practice Resources
Remember: Deliberate practice does not mean looking for answers and memorizing them. You won't go very far with that approach. The more you are able to solve a problem yourself without any reference to answers, the more you will improve.
๐ฐ Leetcode Study Plan
๐ฐ DSA Crack Sheet
Data Structures and Algorithms Cracks Sheet (created by @lovebabbar) contains the most necessary questions to learn and grasp about most common and important DS and Algos
๐ฐ Striver SDE Sheet
Software Developer Engineer Sheet (created by @striver) contains asked during interviews by good product based companies.
The sheet is divided in 30 parts to be completed in a month to get ready for an interview at a good company
๐ฐ Top Interview Preparation Questions
This is LeetCode's official curated list of Top classic interview questions to help you land your dream job. Our top interview questions are divided into the following series:
๐ฐ Companywise Interview Questions
It is containing the list of most asked company wise questions available on Leetcode.
Every pdf file corresponds to a list of questions on leetcode for a specific company based on the leetcode company tags. The list of questions within each pdf is further sorted by their frequency, so the most popular question for a specific company is at the top.
๐ฐ Leetcode Daily Challenges
This Challenge is beginner-friendly. It consists of daily problems given by Leetcode.
A problem is added here each day.
๐ฐ Technical Interview Questions
The Ultimate Guide to Acing Your Technical Interview(2022): Review these commonly asked technical job interview questions and prepare your answer.
๐ Theory Subjects
These must-do questions should be done after studying these subjects
If you don't have much time left for interviews, then you can directly look at them
MUST-DO Questions for Interviews (DBMS, CN and OS)
Operating System:
- What is the main purpose of an operating system? Discuss different types?
- What is a socket, kernel and monolithic kernel ?
- Difference between process and program and thread? Different types of process.
- Define virtual memory, thrashing, threads.
- What is RAID ? Different types.
- What is a deadlock ? Different conditions to achieve a deadlock.
- What is fragmentation? Types of fragmentation.
- What is spooling ?
- What is semaphore and mutex (Differences might be asked)? Define Binary semaphore.
- Beladyโs Anomaly
- Starving and Aging in OS
- Why does trashing occur?
- What is paging and why do we need it?
- Demand Paging, Segmentation
- Real Time Operating System, types of RTOS.
- Difference between main memory and secondary memory.
- Dynamic Binding
- FCFS Scheduling
- SJF Scheduling
- SRTF Scheduling
- LRTF Scheduling
- Priority Scheduling
- Round Robin Scheduling
- Producer Consumer Problem
- Bankerโs Algorithm
- Explain Cache
- Diff between direct mapping and associative mapping
- Diff between multitasking and multiprocessing
DBMS:
- What is DBMS ? Mention advantages..
- What is Database?
- What is a database system?
- What is RDBMS ? Properties..
- Types of database languages
- ACID properties (VVVVV IMP)
- Difference between vertical and horizontal scaling
- What is sharding
- Keys in DBMS
- Types of relationship
- Data abstraction in DBMS, three levels of it
- Indexing in DBMS
- What is DDL (Data Definition Language)
- What is DML (Data Manipulation Language)
- What is normalization ? Types of them ..
- What is denormalization ?
- What is a functional dependency ?
- E-R Model ?
- Conflict Serializability in DBMS ..
- Explain Normal forms in DBMS
- What is CCP ? (Concurrency Control Protocols)
- Entity, Entity Type, Entity Set, Weak Entity Set..
- What are SQL commands ? Types of them..
- Nested Queries in SQL ?
- What is JOIN .. Explain types of JOINs
- Inner and Outer Join
- Practice SQL queries from LeetCode
- Diff between 2 tier and 3 tier architecture
- Diff between TRUNCATE and DELETE command
- Difference between Intension and Extension in a DataBase
- Difference between share lock and exclusive lock, definition of lock
Compute Networks:
- Define network
- What do you mean by network topology, and explain types of them
- Define bandwidth, node and link ?
- Explain TCP model ..
- Layers of OSI model
- Significance of Data Link Layer
- Define gateway, difference between gateway and router ..
- What does ping command do ?
- What is DNS, DNS forwarder, NIC, ?
- What is MAC address ?
- What is IP address, private IP address, public IP address, APIPA ?
- Difference between IPv4 and IPv6
- What is subnet ?
- Firewalls
- Different type of delays
- 3 way handshaking
- Server-side load balancer
- RSA Algorithm
- What is HTTP and HTTPS protocol ?
- What is SMTP protocol ?
- TCP and UDP protocol, prepare differences
- What happens when you enter โgoogle.comโ (very very famous question)
- Hub vs Switch
- VPN, advantages and disadvantages of it
- LAN
1๏ธโฃ Operating System
Overview
- Quick Notes to Follow
- What is an Operating System
- Features of Operating System
- Services provided by an Operating System
- Types of Os
- Batched OS
- Time Sharing OS
- Distributed OS
- Network OS
- Real Time OS
- RAM vs ROM
- SRAM & DRAM
- PROM, EPROM & EEROM
- Virtualisation vs Containerisation
- BIOS vs UEFI
- MBR vs GPT
- Important Terms to Know
- Compiler
- Loader
- Assembler
- Interpreter
- System Calls
- Application Programming Interface
- Kernel
- Shell
- JVM
- Booting
- Multi-programming, Multi-processing, Multi-tasking & Multi-threading
- Monolothic architecture vs MicroKernel arch
- Why Windows kernel is more monolithic & not microkernel?
- What happens when we turn on our computer?
Process Concept
- Process vs Program
- Different State of process
- Types of Process?
- PCB structure in detail
- How does a process look like in memory?
- Process vs Threads
- Process Scheduling
- Introduction
- Inter Process Communication (IPS) in OS
- Scheduling Queue
- Job Queue
- Ready Queue
- Device Queue
- Scheduler
- Short-term Scheduler
- Medium-term Scheduler
- Long-term Scheduler
- CPU Bound Process vs I/O Bound Process
- Best Performance system is which have a combination of CPU bound and I/O bound process
- What is Context Switch?
- IPC
- Introduction
- by Shared Memory
- by Message Passing
- Define Pipe
- Maximum number of Zombie process a system can handle?
Thread Concepts
- What is a Thread?
- Benefits of Multi-threading?
- Example of Multi-threading
- Models
- Many to One
- One to One
- Many to Many
- Best Model??
- Optimal number of threads required for a process?
- Effect of Multiple cores on Multi-threading
- Thread vs Process
- Why C++ static variables are dangerous in real life OS?
Process Scheduling
- Why do we need it?
- CPU Burst Cycle
- CPU Scheduler
- Pre-Emptive Scheduling
- Non PreEmptive
- Advantages/Disadvantages
- Dispatch
- Role of Dispatcher
- Dispatch Latency
- Scheduling Criteria
- CPU Utilisation
- Throughput
- TAT [Turn around Time]
- Waiting Time
- Response Time
- Scheduling Algo
- FCFS
- SJFC
- Priority-based
- Round-Robin
- MLQS
- MLFQS
- Which algo is used in real world OS
- IMP terms to know
- Starvation
- Ageing
- How to prevent Starvation?
Synchronisation
- Why Process Coordinatin/Sync is needed?
- Data Inconsistency
- Race Condition
- Physical Address Space vs Logical Address Space
- Imp terms to know
- Critical Section Problem, peterson Solution
- Why pre-emptive kernel is better than non pre-emptive kernel?
- Semaphore
- Binary Semaphore/Mutex Locks
- Counting Semaphore
- Imp terms to know
- Busy Waiting
- Spin Lock
- Example of busy waiting & spin lock
- How to implement Binary Semaphore in real world coding
- What is Deadlock & Starvation?
- Bounded Buffer, Reader-Writer Problem & Dining Philosopher Problem
Deadlocks
- What is Deadlock?
- Effects of Deadlock?
- Necessary Conditions
- Mutual Exclusion
- Hold & Wait
- No Pre-emption
- Circular Wait
- Methods for Deadlock handling
- Prevention or Avoidance
- Detection or Recovery
- Banker's Algo
- Ostrich Algo
- Resource Per-emption
- Ignorance
Memory-Management
- Imp Points
- CPU can direct access Registers and Main Memory
- Protection of Memory space is handled by Hardware
- OS loads Base and Limit registers
- Mapping from Logical to Physical address is done by MMU[Memory Management Unit]
- OS memory is categorised into
- for the resident of OS
- user processes
- Logical vs Physical address space
- What is Swapping
- Ex-Priority based Scheduling
- Done by Dispatcher
- Context Switch time in swapping is very high
- OS can't swap process that has pending input/output
- Imp topics to cover
- Follow youtube videos
- Memory Allocation
- Contiguous Memory Allocation
- Address Translation: Base and limit Register
- Fixed Partitioning
- Variable Partitioning
- Variable Partitioning
- dynamic storage allocation problem
- Best Fit
- Worst Fit
- First Fit
- Internal Fragmentation
- External Fragmentation
- Compaction
- Non-Contiguous Allocation
- Paging
- Segmentation
- Paging
- Page table
- Page no
- Page offset
- Page Table Limit Register (PTLR)
- Segmentation
- Segment Table
- Base Register
- Limit Register
- Contiguous Memory Allocation
- Why paging increases the context-switch time?
- Page vs Frame?
- What is TLB miss?
Virtual Memory
- Goal of mem. Mgmt
- To keep multiple processes in memory to allow multi-programming
- Virtual Memory
- What?
- Why?
- Where it is physically located?
- How it is implemented?
- Demand Paging
- Strategy to only load pages when they are needed
- Paging + Swapping
- Advantages
- user can write program for extremely large virtual address space
- [CPU utilisation & throughput] increases & [Response Time, Turn aruond time, TAT] remains same
- Less I/O would be needed to load or swap user programs into memory, so each user program would run faster
- Degree of Multiprogramming increases
- allows file and memory to be shared by 2 or more processes through page sharing
- If it is used carelessely, it can decrease performance
- Demand Paging
- paging + swapping
- Lazy Swapper
- pager
- page fault
- Pure Demand Paging
- Swap Space
- Section of hard disk used for implementing Virtual Mem. in swap
- What is Page Fault?
- Page Replacement Algo
- FIFO
- Optimal Page Replacement
- LRU
- What is Frame Rate
- Most Asked Questions (Thrashing)
- What?
- Low CPU Utilisation->Degree of Multiprogramming increases->More Page Fault->Cycle Continues->Thrashing occurs->Page fault occurs tremendously->CPU utilisation decrease sharply
- Cause of Thrashing?
- Solution to Thrashing?
- use priority based replacement algo
- allocate the exact no. of frames that are actually required
- What?
- Can we replace physical memory i.e, RAM with virtual memory?
- Is performance of virtual memory and physical memory same?
Storage Management
(optional)2๏ธโฃ Database Management & Design
Tech Gaints: They usually ask only a bit about normalization, ACID properties(imp.) ans SQP queries & interview is done
Start Ups: They do focus on system design a lot ans in between questions on DBMS are frequently asked So, we need to be 100% prepared for it & best way is to follow the System Design Primer (resource given below) Questions always revolves around the type of DB, why this DB, why not that DB, how to scale, SQL vs NoSQL, your familiarity level with those DBs, etc
Resources
Introduction
- What is Database?
- What is DBMS?
- Why do we need DBMS?
- File management system vs DBMS
- What is Database Admin & it's functions?
- Database Tier-2/Tier-3 Architecture
- Database Language
- DCL
- DDL
- DML
- TCL
- Important Terms
- Instance
- Schema
- Sub-Schema
- How DBMS is implemented?)
- What is Data abstraction in DBMS?
- 3 level of Data Abstraction
- What is Referectial Integrity
RDBMS
- What is RDBMS & how it is stored in memory?
- What is meaning of word "Relational" in RDBMS?
- Degree of Relation
- 1:1
- 1:M
- M:M
- Keys
- Primary Key
- Foreign Key
- Candidate Key
- Alternate Key
- Super Key
- Secondary Key
- Databse Schema
- Physical Databse Schema
- Logical Databse Schema
- Schema Diagrams
- Relational Model
- ER Diagram
- Relational Operations
- Select
- Project
- Union
- Set Different
- Cartesian Product
- Rename
- SQL
- What is SQL
- SQL vs MySQL
- Important Keywords
- CheatSheet: SQL
- Composite key in SQL
- Join & it's types
- Inner Join
- Left Join
- Right Join
- Full Join
- Self Join
- What is View
- What is trigger
- Unique & Primary key in SQL
- What is SQL Injection?
- Delete vs Truncate
- SQL Privileges
- What do you mean by Subquery
- What is difference between clustered and non-clustered indexes?
- What is a Cursor?
- Query Emaples
- Write an SQL query to get third maximum salary of an employee from a table named employee_table
- Write a SQL query to find names of employee start with 'A'
- How can you create an empty table from an existing table?
- How to fetch common records from two tables?
- How to fetch alternate records from a table?
- What is command used to fetch first 5 characters of the string?
- Which operator is used in query pattern matching?
- What is Index in DBMS & it's types
Relational Database Design
- Features of Good Relationsl Design
- What is Functional Dependency?
- Trivial
- Non-Trivial
- Fully-Functional Dependency
- Partial
- Transitive
- What is Normalisation?
- Purpose of Normalisation?
- What are 3 anomalies resolved by normalisation?
- Types of Normalisation? (Purpose and Steps to Convert?)
Storage and File Structure
Transaction Management
- What is a transaction?
- IMP Terms
- Commit
- Rollback
- Savepoint
- ACID Properties
- How to Implement Atomicity in Trsactions?
- Problem of Concurrent Transaction?
- Lost Update
- Dirty Read
- Unpredictable Read
- Incorrect Summary
- Advantages
- Reduced Wai Time
- High Throughput
- High resource utilisation
- Problem of Concurrent Transaction?
- Concurrent Trnsaction?
- Schedule
- Type
- Serial
- Complete
- Recoverable
- Cascadeless
- Strict
- What is Conflict Operation?
- How to find wether Schedules are conflicting or not
- Type
- Concurrency Control
- Purpose?
- Shared Lock
- Exclusive Lock
- 2-Phase Locking PRotocal (important)
- Purpose?
Deadlock
- What is Deadlock?
- Examples?
- Deadlock Detection
- How to prevent Deadlock (already in OS Topics)
- Mutual Exclusion
- Hold and Wait
- No PreEmption
- Circular Wait
- Other Techniques to prevent Deadlock
- use Timestamp
- Wait-Die Scheme
- Wound-Wait Scheme
- Timeout Based Scheme
- What is Starvation and it's reasons?
- Deadlock recovery
- Selection of Victim
- Roll Back
- Starvation
Must Do (for system Design Interview)
3๏ธโฃ Object Oriented Programming
What to expect from these resources,
- To the point for your Interview Preparation
- Sufficient for Academics
Resources
Overview
- What is Object Oriented Programming?
- Object oriented programming is about creating objects that contain both data and functions
- How Object Oriented Programming is related to the real world?
- Example
- Why to study OOPS?
- Limitation of OOPS
- When we say that 'X' language is object oriented programming language, then what does we mean by that ?
- Your Homework
Pillars of OOPS
- What is a Class?
- Difference between Structure & Class
- Similarity between Structure & Class
- When to use Structure over class?
- Access Modifiers
- Public
- Private
- Protected
- Friend
- Protected Friend
- Member Function
- Inside Class Function
- Outside Class Function
- What is Constructor?
- Default Constructor
- Parameterised Constructor
- Copy Constructor
- Virtual Constructor
- Virtual Copy Constructor
- How constructors are different from a normal member function?
- Can we have more than one constructor in a class?
- Destructor
- What is an Object?
- Real world analogy of Class and Object?
- Important Keywords
- Features of OOPS
- Polymorphism
- Inheritance
- What is Inheritance?
- Sub Class
- Super Class
- Reusability
- Why/Need of Inheritance?
- Can Object Oriented Programming exist without Inheritance?
- Types of Inheritance
- Single Inheritance
- Multiple Inheritance
- Hierarchical Inheritance
- Multilevel Inheritance
- Hybrid/Virtual Inheritance
- Real Life Example of Multiple Inheritance
- What are the limitations of Inheritance?
- What is Sealed Modifier?
- How can we call the base method without creating an instance?
- What is the difference between new and override?
- Why Java does not support Multiple Inheritance?
- What is diamond problem in case of multiple inheritance in Java?
- If a class A inherits from class B, then what all is inherited from Parent class?
- Explore Every Combination
- Object Slicing
- How to hide base class methods/functions?
- Friend Function/Class.Inline Function
- Local Class/Nested Class.Simulating Final Class
- Does Overloading works with Inheritance?
- Difference between polymorphism and inheritance?
- Generalisation vs Aggregation vs Composition
- What is Inheritance?
- Encapsulation
- What?
- Combo of Data-hiding & Abstraction
- Advantages/Needs?
- How to achieve?
- Code/implementation Example
- Real World Example
- Difference Between Abstraction and Encapsulation
- What?
- Abstraction
- What?
- Implementation hiding
- When to use?
- How to achieve?
- C++
- Access Specifiers
- header Files
- Java
- C++
- Encapsulation vs Abstraction
- Example
- What are the differences between interfaces and abstract classes?
- What?
- Dynamic Binding
- Message Passing
- Object-oriented design interview questions
Misc
- C vs C++ vs Java
- Difference between procedural programming and OOPs?
- Why Java is not a Purely Object Oriented Language?
- Is an array a primitive type or an object in Java?
- What is early and late binding?
- What is the default access modifier in a calss?
- How many instances can be created for an abstract class?
- Define Garbage collection? How does it works
- Define manipulators
- What fo you mean by finally block?
- What is a final variable?
- What is meant by an exception?
- Is an error basically the same as an exception?
- Exception handling?
- What is the method 'finalize' used for?
- What is a token?
- What are the three arguments of a ternary operator?
- Describe the concept of enum
- Basic understanding of Design Patterns
- Is it possible for a class to inherit the constructor of it's base class?
- When should I use a struct instead of a class?
- Cohesion vs Coupling
4๏ธโฃ Computer Networks
Overview
- Basics
- What is Computer Networking
- Basic Terms
- What is Web?
- Type of transmission Media
- Computer Network Devices
- Unicast, BroadCast and MultiCast
- Networking Topology
- Mesh
- Star
- Bus
- Ring
- Tree
- LAN vs MAN vs WAN
OSI Model
- What
- Different Layers
- PDNTSPA
- Physicsl
- Data Link
- Network
- Transport
- Session
- Presentation
- Application
- PDNTSPA
- How a Packet travels? (V.V.V.Imp)
Misc & System Design
- Common Networking Commands:
- ping
- netstat
- tracert
- ipconfig
- nslookup
- route
- pathping
- netDiag
- hostname
- arp
- Difference in http and https
- What is API Gateway?
- SSL/TLS
- Reverse Proxy?
- Load Balancer
- ARP, Address Resolution Protocol
- Horizontal vs Vertical Scaling
- Caching & How does a website is cached
- What is VIP in Computer Networks
- REST API vs HTTP API
- What is a container in computer networks
- Containerisation vs Virtualisation
- Performance vs Scalability
- Latency vs Throughput
- 2G vs 3G vs 4G vs 5G
- How a VPN works?
- Gateway vs Router
- NIC and MAC Address
- Public vs Private IP Address
- What is Multiplexing
- Modem vs Router
- How Bluetooth Works
- How Hotspot Works
- How Email Works
- How file transfer works
- How ATM works
Security
- What is Firewall?
- Types of Firewall
- Possible attacks on Firewall
- Basic Network Attacks
- Denial of Service and Prevention
- Digital Signature & Certificates
- Terms to know:
- Cryptography
- Symmetrics Key
- Assymetrics Key
- Hashing
- Cryptanalysis
- AES/DES/RSA/MD5 hashing
- Active & Passive attack in Infosec
- Types of Email Attacks
๐ Other Notes and Resources
๐ Best book for Coding Interviews - Cracking-The-Coding-Interview | Link 2
Some other helpful books
- CSES Competitive Programming Handbook
- Problem Solving Strategies
- Programming Challenges
- Concrete Maths
- Algorithms Design Strategies
- The Algorithms Design Manual
Urls for other Notes, and Reading Resources picked from different editorials.
View Resources/Articles
Last Minute Notes
Notes/Question/Explanations
๐ Sources
Other coding websites, hackerearth, interviewbit,gfg, leetcode, codechef, codeforces, CSES Problem Set, Scaler
Youtube channels, love babbar, take you forward,
๐ Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
๐ค Our Contributors
๐ License
Distributed under the MIT License. See LICENSE
for more information.
๐ Contact
Project Link: https://github.com/sachuverma/DataStructures-Algorithms
Sachin Verma : [email protected]
Drop a