😊 Are you a beginner in programming domain?

😢 Are you getting confused of what approach to take while solving a problem?

🙃 Are you wondering why is DSA so important in Problem Solving?

Let's clear all confusions and master the skill through 1️⃣0️⃣ super simple steps 😎

🧵 👇
1️⃣ Read-Realise-Write-Run-Reshape

Yes. I say it often when someone asks me how to approach during solving a problem.

Let's see what are these.
1️⃣.1️⃣ Read & Realise

These 2 actions are so close to each other that we can hardly keep apart.

Do like this.

1. When you try to solve a problem, first "Read" it properly once.

2. Then, "Realise" what it is asking to solve.

++
3. For a bigger or, complex problem, try to divide it into smaller problems. And connect between these smaller problems.

4. Repeat all above steps until you realise and are full confident of what the problem is asking.
1️⃣.2️⃣ Write

When we say "Write", it covers both the design and, code.

Design: During design, we take a problem and try to map between real-world things to programming-world things. The output of design could be a "pseudo code".

++
Code: Now, it's time to give life to our pseudo code. Go and write a program in your favourite language.

During this step, you should already be familiar with the syntaxes of a programming language. If not, first do that.
1️⃣.3️⃣ Run

Before running your program, first list all boundary conditions.

But, what is a boundary condition?
Let's learn it through this example. "Mina decides to sell her old house if someone bids it for 1M"

++
Here boundary condition is "bids for 1M". This condition affects the result.

Perform below steps 👇

1. List all boundary conditions.
2. Define the Input and Output for each boundary condition.

++
3. Combine some or, all boundary conditions and, redefine the Input and Output.

4. Run the program for each input. Verify the actual output with the expected output.

5. Find for which all cases the output is not as expected. We mention it as a "Failed Use case".
1️⃣.4️⃣ Reshape

1. Has your program failed for some use cases?

2. Is your program taking longer than expected time for some inputs?

You should come back and, reshape the old program. Inspect the problem. Modify the code and, do an impact analysis (impact on successful use cases)
In following tweets, we will go through various design steps.

While designing a solution, we have to consider all these and come up with a pseudo code.
2️⃣ Value & Variable

Let's learn from example.

The stock price now is $1.45

Here,

"Stock Price" is a variable because it is not constant.
"1.45" is a value.

We write in pseudo code,

StockPrice = 1.45
3️⃣ Formula

Formula could be anything. But here I meant it for "Arithmetic Formula".

E.g., For the rate of interest of 5%, find the simple interest for 1 year.

For arithmetic formula, you should be knowing arithmetic operations like +, -, *, /, % and, their precedences.
4️⃣ Comparison

We live in a world where comparison is everywhere 😆

Example: Those whose height is more than 167cm are selected.

And we write it as,

Height > 167

Output of a comparison is typically "Yes" or, "No". Or, more programmatically "True" or, "False".
5️⃣ Condition

In above example height is compared with a value. And, the whole expression is a condition.

Multiple conditions can be combined.

E.g., Those "who are boys" and have "height more than 167cm" are selected.

2 conditions are "who are boys", "height more than 167cm".
Issue is how should conditions be combined?

Let's see.

AND: Combine conditions using AND (or, && in programming), when "all conditions" should be "True"

OR: Combine conditions using OR (or, || in programming), when "at least one condition" should be "True"
6️⃣ Assign

When you perform some operation, you assign the output to a "Variable" so that this variable can be used further when the value is needed.

Example:

x = a * b

Here we "multiplied 2 numbers" and "assigned" the result of multiplication to a variable "x"
7️⃣ Action

He ran for 2 miles. Here action is "ran for 2 miles".

In programming, we write

RunDistance = 2

Action is real-world is synonymous to "Statements in Programs"
8️⃣ Conditional Action

Conditional Action is an action which is executed on certain conditions.

Example: Those whose height is more than 167cm are selected.

Here "Selection" is the action, but it's conditional.

In Programming, we use

1. If
2. If...Else...
3. If...ElseIf...
9️⃣ Iteration

Example: They all ran in a 4x400m relay race.

Here, 400m race is "repeated" for 4 times.

When, we need to do a task repeatedly, we need to use iteration.

In Programming, we use

1. for
2. while
3. do...while...

The iteration continues till a condition is met.
1️⃣0️⃣ Data Structures

Values are essential and, important in any program. For effective handling of these values, data structures are important.

Example: Array, Set, Stack, Queue, Tree, Graph etc.

In my upcoming DSA series, I will show how to decide a correct data structure.
I have written this thread keeping in mind that we should be familiar in "approaching to solve a problem" before starting the DSA series.

I hope this thread helps you to reach a satisfactory point where you can confidently design a solution

Share your feedbacks. See you soon 👋

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Swapna Kumar Panda ✨

Swapna Kumar Panda ✨ Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @swapnakpanda

16 Oct
7️⃣5️⃣ Data Structures and Algorithms (DSA) questions

You should be able to master all these in coming days through the upcoming DSA series.

🧵 👇
1️⃣ Algorithms Basics

1️⃣ What is an algorithm?
2️⃣ How to approach to solve a problem?
3️⃣ What is time complexity? How to measure it?
4️⃣ What is space complexity? How to measure it?
2️⃣ Data Structure Basics

5️⃣ What are types of data structures?
6️⃣ What are some mostly used data structure operations?
7️⃣ What is traversal?
8️⃣ How to insert an element?
9️⃣ How to delete an element?
1️⃣0️⃣ How to get an element?
1️⃣1️⃣ How to update an element?
Read 19 tweets
15 Oct
Are you new to Data Structures and Algorithms (DSA)?

Let's get to know about all of those we would be learning.

🧵 👇
1️⃣ Array

👉 Data Structures

1️⃣ One-Dimensional Array
2️⃣ Multi-Dimensional Array

👉 Algorithms

1️⃣ Traverse
2️⃣ Insert
3️⃣ Delete
4️⃣ Get
5️⃣ Search
6️⃣ Size
7️⃣ Reverse
2️⃣ Linked List

👉 Data Structures

1️⃣ Singly Linked List
2️⃣ Doubly Linked List

👉 Algorithms

1️⃣ Traverse
2️⃣ InsertAtHead
3️⃣ InsertAtEnd
4️⃣ Insert
5️⃣ DeleteAtHead
6️⃣ DeleteAtEnd
7️⃣ Delete
8️⃣ Update
9️⃣ Get
1️⃣0️⃣ Search
1️⃣1️⃣ IsEmpty
1️⃣2️⃣ Reverse
Read 13 tweets
13 Oct
🔥 9️⃣ Useful Hacks to simplify your JavaScript code

Follow these simple yet most useful hacks in your code. These are not only modern way of writing JS code but also minifies your code.

🧵 👇
We will cover,

1️⃣ Converting to Boolean
2️⃣ Converting to Number
3️⃣ Converting to String
4️⃣ Short-Circuit && and ||
5️⃣ Default Function Parameters
6️⃣ Nullish Coalescing Operator
7️⃣ Optional Chaining Operator
8️⃣ Array Resizing
9️⃣ Converting Array-Like to Array
1️⃣ Converting to Boolean

To convert any data to a Boolean type, use

→ Boolean function or,
→ !! operator
Read 12 tweets
12 Oct
🔥 Array and Object Destructuring in JavaScript 🚀

This 🧵 will have everything that you may need to learn this important feature of "Destructuring".

Let's explore 👇
We will discuss about

→ History (why this feature was necessary)
→ Introduction to Destructuring
→ How does destructuring work?
→ Limitations and future improvements

Let's deep dive 🚀
0️⃣ Some History

Back to 2015, JS codes were a little heavy.

If I had an array, say

arr = [10, 20]

To access elements of the array, I had to use index. Eg., arr[0], arr[1].

And if I had to store these values in some other variables, then

first = arr[0]
second = arr[1]

++
Read 22 tweets
17 Aug
6 Insert Techniques for JavaScript Arrays

Check the 🧵 👇

#DEVCommunity #javascript
(1/n)

Insert an element at the beginning of an array by both mutating and not mutating the original array.

👇
(2/n)

Insert an element at the end of an array by both mutating and not mutating the original array.

👇
Read 6 tweets
16 Aug
🔍 Search Operation Explained for Non-Programmers

A comprehensive 🧵 👇 🔍  Search Operation Explained for Non-Programmers
In this 🧵, I will explain

🙋🏼‍♀️ What is Search?
🙋🏼‍♀️ Where do we use it?
🙋🏼‍♀️ How important is it?
🙋🏼‍♀️ How better can it be?

Understand about concepts like Sorting, Hashing.

No programming knowledge required for reading this thread.
(1/n)

What is Search? - Search is basically when you are looking for something.

You must have come across terms like 'Find', 'Filter', 'Fetch', 'Get', 'Check', 'Select', 'Read', 'Look for' etc. They all involve 'Search'.
Read 19 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!

:(