Skip to content

Instantly share code, notes, and snippets.

View rambabu-patidar's full-sized avatar
🎯
Focusing

Rambabu Patidar rambabu-patidar

🎯
Focusing
View GitHub Profile
@rambabu-patidar
rambabu-patidar / bubbleSort.cpp
Created April 12, 2023 18:01
code for bubble sorting algorithm.
#include<iostream>
using namespace std;
void bubbleSort( int arr[], int n){
for( int i=1;i<=n-1;i++){
for(int j=0;j<=n-i;j++){//if u don't want to start the j loop from 1
//then start it from 1 but theu arr[j] will be replaced by arr[j-1]
if( arr[j]>arr[j+1]){
int temp = arr[j];
arr[j]= arr[j+1];
@rambabu-patidar
rambabu-patidar / cycleDetectUsingDFS.cpp
Created July 19, 2023 05:27
Detect cycle in undirected graph using DFS
#include <bits/stdc++.h>
using namespace std;
// to detect cycle in undirected graph we will keep track of the parent node
// if the nbr of a vertex is visited and not its parent that means cycle is present.
// we have to keep track of parent because in undirected graph visited node can be its parent
// which is not considered as back edge.
class Graph
{
@rambabu-patidar
rambabu-patidar / cycleDetectUsingBFS.cpp
Created July 19, 2023 05:28
Detect cycle in undirected Graph using BFS
#include<bits/stdc++.h>
using namespace std;
class Graph
{
private:
int n;
vector<int> *list;
public:
@rambabu-patidar
rambabu-patidar / TestingLibraryElementError.txt
Created July 26, 2023 17:30
TestingLibraryElementError while build with Node.js workflow
Run npm test
> [email protected] test
> react-scripts test
FAIL src/App.test.js
✕ renders learn react link (88 ms)
● renders learn react link
@rambabu-patidar
rambabu-patidar / bubbleSort.cpp
Created August 16, 2023 14:15
Bubble sort resursive.
#include<bits/stdc++.h>
using namespace std;
void swap(vector<int>& nums, int i, int j)
{
int temp = nums[i];
nums[i] = nums[j];
nums[j] = temp;
}
@rambabu-patidar
rambabu-patidar / minimum-spanning-tree.md
Created September 15, 2023 18:28
minimum-spanning-tree

MINIMUM SPANNING TREE NOTES

ST(Spanning Tree) is a tree like subgraph of a connected, undirected graph that include all the vertices of the graph. In simple words, It is a tree like structure (hence no cycle) where the edges are the subset of graph and vertices are the exact set of original graph.

MST is excatly same like ST but with one more constraint of having minimum weight sum of edges.

Properties

Some basics first before main question!

__dirname : This gives us the path from the OS to the folder in which you used it. (important is folder here because we used this command in some file that reside inside that folder) FOR EXAMPLE: C:\Users\Lenovo\Desktop\Fun\routes\shop.js this is the path in which we used __dirname then we will going to get path upto C:\Users\Lenovo\Desktop\Fun\routes\

__filename: This command when used gives the full path from OS to the file in which we used it. So for above example we will get C:\Users\Lenovo\Desktop\Fun\routes\shop.js

Now we know that node js ships with it a core module that is path module.