## Posts

### Calculating size of User and Cache storage

user storage:-
it can be solved using same scenario as mentioned in first article .

https://tech.nazarmubeenworks.com/2019/08/basics-of-system-design-chapter-0.html

Suppose there are 12 Million of users are adding every year meaning 1 Million per month.
So if we consider 5 year there will be around 60 million of users. Now in terms of data we can look to our DB table and get information about it. A user will be generally having name , id , address , some forien keys .
Lets assume 10 columns with each column on an average storing 4 byte of data.
10*4 = 40 bytes of data for one user.
60 * 10^6 * 40 = 2400 * 10^6 = 2.4 * 10^9 = 2.4 GB of data we need to store only user values.
Also while calculating storage for the user there is also one important point we need to remember is of ids. If we are going to have 60 Million of users which means 60*10^6 users so unique id’s will be
as we know below figures are almost equal
2^10=10^3 then 60*(10^3)^2 = 2^20 *2^6
which means we almost need 26 …
Recent posts

### Basics of System Design

1) what is the number of requests a website will recieve in a day/month/second? 2) what is the amount of memory a website will deal in a day/month/second? 3) what is the number of servers that can accomodate these requests?
To answer this , first we need to remember the below numbers:-
1 million = 10 lakh = 1000000 = 10^6 1 billion = 1000 million = 10^9
1 KB = 1024 B = 10^31 MB= 10^6 = 1024 KB 1 GB= 10^9 = 1024 MB1 TB = 10^12 = 1024 GB
Memory we need to see in BytesRequests we need to see in numbers
example :-
suppose a website recieves 100M requests every month then:-
requests per day = request per month /24 = 416700 requests requests per second = requests per day / (24*3600) = 4.8 requests per second
memory:-
if we take 20:80 principal where 20 percent is write and 80 percent is …

### Topics to Start - preparing for Data Structures and Algorithms

Learn in a different way :-

Stringsstacks and queuesheapssearchinghash tablesortingrecursiondynamic programminggreedy algorithmsgraphstreeBinary Search TreeLinked ListArrayParallel programming and concurrencydesign problemssystem designavailability and scalability  Below topics are good to have object oriented programminglanguage details ( java , python)object oriented designtools ( bash , git , maven , jira , jenkins , docker , kubernetes)database

### How to do Effective Programming?

There is no secret to doing effective programming but following a sequence of steps and procedures can help in building great programs. Today I will take you on a tour to some of the best practices that are integrants of perfect programs.
Algorithms are important: - You can’t deny the fact that algorithms are important and before start to write any program, Algorithms are must to write. For example, if there is a program about finding the sum of two numbers? What will you write ?The steps can be :-
1)Get the first number. 2)Get the second number. 3)Add both numbers.
This is what algorithm is writing about ,a list of statements .From the above three statements you can conclude boundary cases (at least two number should be there in input), mathematical function(Sum is needed here) , storage capacity(amount of memory to be assign to the variables), number of methods by analyzing repeat steps (reduce replete codes) and many other things. During algorithm only you can build a solid idea about h…

### Left Rotation in an Array using Java

Left Rotation in an Array using Java
There are two methods implemented by me here :-
1) Using extra Array   Get new position of  a current element using formula. Add the element in the new position in a new array.

2) Using same Array:- This is little bit complex
hold variable at index i.find new index for variable.hold variable present at new index.place variable at index i to this new index.assign i to new index variable.repeat steps until count is not equal to lenght of an array which simply means all variable got covered.

package Arrays;/* * 12345 to 34512 *//* * sample input * 5 4(d=4 that is 4 rotations) 1 2 3 4 5 sample output 51234 */publicclassLeftRotation{publicstaticvoidprintArray(int[] arr){for(int i=0;i<arr.length;i++){ System.out.print(" "+arr[i]);} System.out.println(" ");}//method which returns rotated array using extra arraypublicstaticint[]leftRotate(int[] arr,int rotation){int temparr[]=newint[arr.length];int pos;for(int i=0;i<arr.length;i+…

### Difference between Abstract Class and Interface

Difference between Abstract Class and Interface
Difference between abstract class and interface ?

Abstract Class:-

1) Can have abstract and non-abstract method both.
2) One class can extend at most one class.
3) can declare non abstract method and also can define body for it.

Interface:-
1) can have only abstract method.
2) One class can implement multiple interfaces.
3) can't delare body to a method.

Please look below example for more understanding:-

package Basics;publicabstractclassAnimal{int head;//no body (unimplemented function need to override in child class as a//compulsionabstractvoidsetLegs();//having body//may override or may notvoidsetHead(){ head=1;}}package Basics;// can have only methods and by default all are abstract need to be override//by implementing class, unlike abstract no method can havedefinitionpublicinterfacePet{voidtellWhereAreYouFrom(String place); String tellYourWeight(String weight);}package Basics;// can extend one class but can implement multiple interf…

### basics of java in layman term for beginner

Basics of java in layman term for beginner
What is an object ?

object is a real world entity.

Object is an instance of the class.It means something that is alive. Let us take an example of CAR:-

concept of a car is class. I mean we all know that it is having four tyres , one engine , four doors , a seat e.t.c. but we can't do anything just by the concept we need real Car to perform operations on it . This real car is what we call is an object.

Explain about main()method in java ?

main() method is an entry point of a program.
public static void main(String[] args)

Why main()method is public, static and void in java ?

public: It can be accessed from anywhere.
static: no class object need to call this method.
void: it is not returning anything in back.

What is JIT compiler ?

JIT is just in time compiler.JIT compiler runs after the program has started and compiles the code (usually bytecode or some kind of VM instructions) on the fly (or just-in-time, as it's called) into a form that's usu…