Skip to main content

Cheats For Sorting Algorithm

Sorting algorithm

1. Bubble Sort

2. Insertion Sort

3. Selection Sort 

4. Merge Sort

5. Quick Sort


Quick Sort - The partition logic of quick sort is very powerful problem solving tool. there are 2 partition logic 

1. Horare's Partition Scheme 

2. Lomuto's Partition Scheme , This is used for Kth order statistics, example 3rd Highest or Lowest element in the given list. 


 

Comments

Popular posts from this blog

Hexagonal Architecture (Ports & Adapters Pattern)

Hexagonal Architecture , also known as the Ports and Adapters pattern, is a software design pattern that aims to create a decoupled and maintainable application by separating the core business logic from external concerns (like databases, APIs, and UIs). Structure of Hexagonal Architecture A typical Hexagonal Architecture has three main layers: 1️⃣ Core Domain (Application Logic) This contains the business rules and domain models. It is completely independent of external technologies . Example: If you’re building a banking system , this part would include logic for transactions, withdrawals, and deposits . 2️⃣ Ports (Interfaces) These are interfaces that define how the core interacts with external components. Two types of ports: Inbound Ports (driven by external inputs like APIs, UI, or events) Outbound Ports (used to interact with external services like databases, messaging systems, etc.) 3️⃣ Adapters (Implementation of Ports) These are concrete implementations of the ports, re...

"Action-Oriented, Stakeholder-Focused" MoM Structure

  I. Meeting Header: Meeting Title:  Clear and concise (e.g., "Project X Status Update," "Q3 Planning Meeting"). Date and Time:  Record the date and time the meeting took place. Location/Platform:  Indicate where the meeting was held (e.g., Conference Room A, Zoom). Attendees:  List the names and roles of everyone who attended. Absent:  List the names of key individuals who were invited but did not attend. Meeting Owner : Who was in charge of the meeting ? Document owner : Who is in charge of the documentation ? II. Key Discussion Points (Concise Summary): Purpose:  Briefly summarize the main topics discussed. Format:  Use bullet points for brevity. Content: Decision Points:  Clearly state any decisions that were made. Key Information:  Summarize any crucial information shared. Key Questions : Summarize the key questions that were raised. Open Issues:  Note any issues that remain unresolved. Stakeholder Focus:  Frame the summar...

Recursion & Choice

Understanding Recursion and Choice Diagrams with Examples Understanding Recursion and Choice Diagrams with Examples Recursion is a powerful concept in programming where a function calls itself to solve smaller instances of the same problem. It's often used in solving complex problems that can be broken down into simpler subproblems. In this blog post, we'll explore the basics of recursion, understand choice diagrams, and see examples to illustrate these concepts. What is Recursion? Recursion occurs when a function calls itself directly or indirectly to solve a problem. A recursive function must have a base case to terminate the recursive calls and prevent infinite recursion. Here's a simple example of a recursive function to calculate the factorial of a number: public class RecursionExample { public static void main(String[] args) { int number = 5; int result = factorial(...