GithubHelp home page GithubHelp logo

bhumikatewary / practice-problems Goto Github PK

View Code? Open in Web Editor NEW
26.0 1.0 88.0 1.53 MB

All DSA Solutions in one repo! You are free to contribute your code.

License: MIT License

C++ 61.96% Python 3.68% Java 31.10% C 2.47% Makefile 0.06% PHP 0.34% JavaScript 0.39%
algorithms code cpp data-structures problem-solving solutions hacktoberfest hactoberfest-accepted hactoberfest-2022 contributions-welcome

practice-problems's Introduction

Hello World! I'm Bhumika πŸ‘©β€πŸ’»


I am an Undergraduate Student pursuing my B.Tech from Heritage Institute of Technology, Kolkata


GIF

  • 🌱 I’m currently learning Data Analytics
  • πŸ‘― I’m looking to collaborate on open source
  • πŸ“« Reach out to me: [email protected]
  • ⚑ Fun fact: I know how to play a piano

πŸš€ My Work Stack:

github actions Google Cloud Platform TypeScript git angular html5 Nodejs vscode sql overleaf android canva figma bootstrap django jquery jupyter xampp c css3 javascript numpy python json msoffice linux windows



I am currently listening to:

Spotify


πŸ“Š My Github Stats:


My Awesome Stats

GitHub Streak

trophy

Bhumika Tewary's Top Languages

Connect with me through

practice-problems's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

practice-problems's Issues

Java Stack Code

I would like to upload my stack implementation in java code to you repo

Java code for array

In the Array folder ,Can i write the code in java else you can tell me in which part should i work on through java language .

Thank - you

Prim's Minimum Spanning Tree

I want to add implementation of Prim's Minimum Spanning Tree of a Graph using C++. Please assign this task to me.

First Missing Positive

I want to add first missing positive integer solution in arrays using java. Please assign this task to me.

searching in python

  • Add Searching algorithm in python
    • make it easy to understand for beginners
  • Two searching algorithms
    • binary search
    • linear search

Kruskals implementation in c++

//Given an undirected, connected and weighted graph, find Minimum Spanning Tree (MST) of the graph using Kruskal’s algorithm.
#include<bits/stdc++.h>
using namespace std;

// Creating shortcut for an integer pair
typedef pair<int, int> iPair;

// Structure to represent a graph
struct Graph
{
int V, E;
vector< pair<int, iPair> > edges;

// Constructor
Graph(int V, int E)
{
    this->V = V;
    this->E = E;
}

// Utility function to add an edge
void addEdge(int u, int v, int w)
{
    edges.push_back({w, {u, v}});
}

// Function to find MST using Kruskal's
// MST algorithm
int kruskalMST();

};

// To represent Disjoint Sets
struct DisjointSets
{
int *parent, *rnk;
int n;

// Constructor.
DisjointSets(int n)
{
    // Allocate memory
    this->n = n;
    parent = new int[n+1];
    rnk = new int[n+1];

    // Initially, all vertices are in
    // different sets and have rank 0.
    for (int i = 0; i <= n; i++)
    {
        rnk[i] = 0;

        //every element is parent of itself
        parent[i] = i;
    }
}

// Find the parent of a node 'u'
// Path Compression
int find(int u)
{
    /* Make the parent of the nodes in the path
    from u--> parent[u] point to parent[u] */
    if (u != parent[u])
        parent[u] = find(parent[u]);
    return parent[u];
}

// Union by rank
void merge(int x, int y)
{
    x = find(x), y = find(y);

    /* Make tree with smaller height
    a subtree of the other tree */
    if (rnk[x] > rnk[y])
        parent[y] = x;
    else // If rnk[x] <= rnk[y]
        parent[x] = y;

    if (rnk[x] == rnk[y])
        rnk[y]++;
}

};

/* Functions returns weight of the MST*/

int Graph::kruskalMST()
{
int mst_wt = 0; // Initialize result

// Sort edges in increasing order on basis of cost
sort(edges.begin(), edges.end());

// Create disjoint sets
DisjointSets ds(V);

// Iterate through all sorted edges
vector< pair<int, iPair> >::iterator it;
for (it=edges.begin(); it!=edges.end(); it++)
{
    int u = it->second.first;
    int v = it->second.second;

    int set_u = ds.find(u);
    int set_v = ds.find(v);

    // Check if the selected edge is creating
    // a cycle or not (Cycle is created if u
    // and v belong to same set)
    if (set_u != set_v)
    {
        // Current edge will be in the MST
        // so print it
        cout << u << " - " << v << endl;

        // Update MST weight
        mst_wt += it->first;

        // Merge two sets
        ds.merge(set_u, set_v);
    }
}

return mst_wt;

}

// Driver program to test above functions
int main()
{
/* Let us create above shown weighted
and undirected graph */
int V = 9, E = 14;
Graph g(V, E);

// making above shown graph
g.addEdge(0, 1, 4);
g.addEdge(0, 7, 8);
g.addEdge(1, 2, 8);
g.addEdge(1, 7, 11);
g.addEdge(2, 3, 7);
g.addEdge(2, 8, 2);
g.addEdge(2, 5, 4);
g.addEdge(3, 4, 9);
g.addEdge(3, 5, 14);
g.addEdge(4, 5, 10);
g.addEdge(5, 6, 2);
g.addEdge(6, 7, 1);
g.addEdge(6, 8, 6);
g.addEdge(7, 8, 7);

cout << "Edges of MST are \n";
int mst_wt = g.kruskalMST();

cout << "\nWeight of MST is " << mst_wt;

return 0;

}

[c++] Number of 1 bits (aka hamming weights)

I noticed there's already an implementation in the bit manipulation folder, but I'd like to add a second implementation that uses the standard library to calculate the hamming weight of a number.

First Missing Integer Python

I'd like to implement the following algorithm for Python:

Given an unsorted integer array, find the first missing positive integer.
Example:
Given [1,2,0] return 3,
[3,4,-1,1] return 2,
[-8, -7, -6] returns 1

Your algorithm should run in O(n) time and use constant space.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.