Skip to content

shahidul034/Data-Structures-and-Algorithm-Tutorial

Repository files navigation

Data-Structures-and-Algorithms

Contents

#Lab Topics name
1 Installation and Introduction to Datatypes, Arrays, Pointers, Structures, and Class
2 STL (Standard Template Library)
3 Stacks and Queues
4 Linked Lists (Part 1)
5 Linked Lists (Part 2)
6 Graphs
7 Sorting
8 Trees
9 Backtracking
10 ⏳Hashing
11 ⏳Dynamic Programming

👀Miscellaneous code

💡Random Number generation

#include <iostream>
#include <cstdlib>  // for rand() and srand()
#include <ctime>    // for time()
using namespace std;
// Function to return a random number in a given range [min, max]
int getRandomNumber(int min, int max) {
    // Ensure that the range is valid
    if (min > max) {
        cerr << "Invalid range" << endl;
        return -1;  // or throw an exception
    }
    
    // Initialize random seed based on the current time
    srand(static_cast<unsigned int>(time(nullptr)));
    
    // Generate a random number between min and max
    return min + rand() % ((max - min) + 1);
}

int main() {
    int min = 1, max = 100;
    int randomNum = getRandomNumber(min, max);
    cout << "Random number between " << min << " and " << max << ": " << randomNum << endl;
}

Citation

@misc{Salim2024,
  author = {Salim, Md. Shahidul},
  title = {Data Structures and Algorithm Tutorial},
  year = {2024},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/shahidul034/Data-Structures-and-Algorithm-Tutorial}},
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published