Skip to main content

HLD & LLD

Comments

.

Popular posts from this blog

Selection Sort in JAVA

What is selection sort? It is a sorting technique that is based on the partitioning of array into two parts, sorted and unsorted. The process is:- 1) Find minimum element in unsorted array. 2) Swap the element at the end of sorted array. when i=0 we don't have any sorted array so element will be replaced from first element later the sorted array end will growas the index. Steps:- underline elements are sorted array, the length is increasing with each minimum element added at the end. minimum element11 11 25 12 22 64 minimum element12 11 12 25 22 64 minimum element22 11 12 22 25 64 minimum element25 11 12 22 25 64 minimum element64 11 12 22 25 64 Program:- package sorting ; public class SelectionSort { //function to print array public static void print ( int [] arr ) { for ( int i = 0 ; i <= arr . length - 1 ; i ++) System . out . print ( " " + arr [ i ]); System . out . printl

Depth First Search Implementation in Graph

Depth First Search Implementation in Graph -- Graph //This is a class to define the vertex in a graph public class Vertex { char label ; boolean visited ; public Vertex ( char label ){ this . label = label ; this . visited = false ; } package Graph ; import java.util.ArrayList ; import java.util.HashMap ; import java.util.Iterator ; import java.util.Map ; import java.util.Map.Entry ; // this class is abstract because we won't allow you make instance of it , it is of no use until not extended abstract public class GraphBase { //declaring instance of vertex Vertex vertex ; //declaring an array of vertex to hold all the vertex static Vertex [] vertexlist = new Vertex [ 10 ]; //declaring edgelist to hold all edges key is vertex value is neighbouring vertex static HashMap < Character , ArrayList < Character >> edgelist = new HashMap <>(); //count of vertex and edge static int