Select Page

# Get Free Big O Cheatsheet

To get free Big O cheatsheet, Fill in your name and email to get your copy.

Do not scared, we do not spam your inbox.

### Start learning

๐ Micro services Architecture and Design patterns.
๐ Data Structures and Algorithm

# Introduction and Characteristics of Algorithm

Introduction and Characteristics of Algorithms is explained in detail below

# Recap – Data Structures

The programmatic way of storing data, so that it can be used efficiently. Almost every enterprise application uses various types of data structures in one or the other way.

## Algorithm Introduction

ย ย ย  Introduction and Characteristics of Algorithms, Algorithm is a step-by-stepย  programmatic way of storing data, so that it can be used efficiently. Almost every enterprise application uses various types of data structures in one or the other way.

ย ย ย  Algorithm is step-by-step procedure for solving a problem in finite number of steps. In other words it is finite set of well-defined instructions written in human readable language for solving a given problem. An algorithm is division of a problem into small steps which are in sequence. Algorithm is very important way for computers to understand the problem and process the information accordingly.

ย ย ย  Problem can always be solved in multiple ways or can have multiple solutions to solve. Similarly Algorithms also can be written any number ways to solve the problem. Let us see the characteristic of an Algorithm.

### Characteristic of an Algorithm:

ย Writing an Algorithm must possess the following characteristics.

• Finiteness : Each algorithm must have finite number of steps, or must terminate after finite number of steps.
• Input : algorithm may not have input or have many inputs.
• Output :ย  Must have 1 or more well-defined output, should match the desired output.
• Unambiguous : Algorithm must be clear and unambiguous, each of the input and output
• Feasibility : Resources must be utilized properly, Should never waste the resource.
• Independent : Algorithm must be independent of any Programming languages.

In the next article in details about the Big O Notations in data structures with example.

LIKE | SHARE | FOLLOW

# Data Structures and Algorithms

## Data Structures

The programmatic way of storing data, so that it can be used efficiently. Almost every enterprise application uses various types of data structures in one or the other way.

## Algorithms

ย ย ย  Algorithms is a step-by-step ย  e programmatic way of storing data, so that it can be used efficiently. Almost every enterprise application uses various types of data structures in one or the other way.

### Why do we need to learn Data Structures and Algorithms?

ย ย ย  Every day the complexity of applications are increasing which result in more complex and rich sets of data, due to the complexity we generally face the following 3 types of problems every day.

#### Problems faced by the large enterprise or corporate (service and data):

1. Data Searching: Consider users registered in social app is more than 1 million, if we want to search for one person in that 1 million, the search operation need to be performed on that 1 million user records. Thus the search operation slows down every time new user data is stored.
2. Processor capacity/speed: Capacity of processor need to be very high to handle such large sets of data. Failing to do so will cause poor performance and bad experience to the users.
3. Too-many requests: Everyone hold PC/Laptop, Mobile devices and IoT gadgets which connects to the service to perform some operation on the data. Thus the number of service request sent and received by the devices and the server are way many. Even the fastest server might fail to respond sometimes.

#### How to solve the above problems?

ย ย ย  To solve the above 3 problems (Data Searching, Processor capacity/speed & Too-many requests) we can use the Data Structures.

ย ย ย  Data can be organized in a way that data is categorized and sorted before searching, thus allowing us to search instantly.

### Exactly what is that we are going to do with Data structures and algorithms?

ย ย ย  As we already know the Algorithms is step-by-step procedure for performing an operation. And that operations are used for manipulating the data. Let’s us see the operations or the categories of algorithms.

#### Categories of algorithms:

• Search
• Sort
• Insert
• Update
• Delete

In the next article in details about the algorithms and the data structures implementation with example.

LIKE | SHARE | FOLLOW

#### WeCanCode-Author

January 08, 2022

Senior Developer | Java & C#.NET | 10++ years of IT experience.

Planning to learn ReactJS or Angular or Flutter.!

# Free Ebook on Microservice Architecture and Design Patterns

โYou are never too old to set another goal or to dream a new dreamโ-S. Lewis

Start learning ๐ Micro services Architecture and Design patterns.

# What are the Saga design pattern and types available?

Today we will see what are the Saga Design Pattern and types available.

Previously we saw about What is Microservice? and the principles followed while developing MSA and the available design patterns.

## What are the Saga design pattern and types available?

The Saga Pattern is a microservices architectural pattern to implement a transaction that extends multiple services.

A saga is a sequence of local transactions. Each service in a saga performs its own transaction and publishes an event. The other services listen to that event and perform the next local transaction. If one transaction fails for some reason, the saga also executes compensating transactions to undo the impact of the preceding transactions.

##### Example:

Consider a Food delivery service flow, When a user places an order, below could be the flow.

1. The food ordering service creates an order. At this point, the order is in PENDING status.
2. With the Saga pattern, it contacts the restaurant via the restaurant service.
3. The restaurant service attempts to place an order with the selected restaurant, Once the order is received by Restaurant it sends back an ORDER_ACCEPTED (if the order is accepted) or ORDER_REJECTED (if the order cannot be accepted) status.
4. The saga received the status ORDER_ACCEPTED or ORDER_REJECTED status and process the response to the customer accordingly.
5. The food order service then changes the status of the order, if the order is accepted then it displays an order confirmation message if the order is rejected it display an apologies message and suggest alternative restaurants.

### Types of Saga:

1. Orchestration-based saga
2. Choreography-based saga

In the next article, we will see in detail about the Type of Saga design patterns.

LIKE | SHARE | SUBSCRIBE

#### WeCanCode-Author

December 07, 2021

Senior Developer | Java & C#.NET | 10++ years of IT experience.

Planning to learn ReactJS or Angular or Flutter.!