0% found this document useful (0 votes)
36 views11 pages

Final Report GFG

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views11 pages

Final Report GFG

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Data Structures and Algorithms - Self Paced

[Online Course] (GEEK FOR GEEKS)

NAME:- NILOTPAL BHARDWAJ

REGISTERATION NO:-12210197

SECTION:- K22SK

FINAL REPORT
The Online course consist of parts:-
1. Chapters:- Which consist videos and practise
problems and article.
2. Notes:- Pdf notes provided by the host.
3. Contest:- It’s is the practical level of knowledge
understanding which consist of questions.
COURSE DEATAIL

1. What is DSA?

o DSA stands for Data Structures and Algorithms.

o It’s a fundamental topic in computer science and software engineering.

o DSA deals with organizing and manipulating data efficiently.

o Understanding DSA is crucial for writing efficient and optimized code.

2. Why Study DSA?

o Efficiency: DSA helps you write code that runs faster and uses less memory.

o Problem Solving: DSA equips you with tools to solve complex problems.

o Interviews: DSA questions are common in technical interviews.

o Real-World Applications: DSA is used in databases, search engines, compilers,


and more.

3. How to Approach DSA?

o Learn Data Structures: Understand arrays, linked lists, trees, graphs, stacks,
queues, etc.

o Study Algorithms: Learn sorting, searching, dynamic programming, greedy


algorithms, etc.

o Practice: Solve problems on platforms like LeetCode, HackerRank, and


Codeforces.

o Analyze Complexity: Understand time and space complexity.

o Implement: Write code for common algorithms and data structures.


COURSE OUTCOME:- This Data Structures and Algorithms course is
designed to help you master the essential skills needed for programming and DSA coding interviews.
In this complete DSA course, you'll learn about various data structures like arrays, linked lists,
stacks, queues, trees, and graphs. You'll also learn about important algorithms such as sorting,
searching, and hashing.

In this self-paced online DSA course, well start with the basics of each data structure, explaining how
they work and their real-world applications. You’ll understand how to implement these data
structures in popular programming languages like Python, Java, and C++. The online DSA course will
cover key algorithms, teaching you how to sort data efficiently, search for elements quickly, and use
hashing for faster data retrieval.

By the end of the course, you’ll have a solid understanding of data structures and algorithms, which
are crucial for solving complex coding problems and clearing technical interviews. Whether you’re
preparing for a job at a top tech company or looking to enhance your programming skills, this course
provides everything you need to succeed.

CERTIFICATION:-

PROJECT:- SUDUKO SOLVER


1.) CODES
A)[Link]
#include <iostream>

#include "sudoku.h"

int main(void)

Sudoku s(9, 9);

std::string puzzle =

"0 6 0 0 4 0 8 0 0\n"

"8 0 0 7 2 0 3 0 9\n"

"4 0 0 0 0 0 0 0 6\n"

"7 0 0 1 0 0 0 9 0\n"

"0 0 8 0 7 0 0 0 2\n"

"0 9 0 5 0 0 0 0 4\n"

"0 0 6 0 0 0 0 0 0\n"

"0 0 4 0 0 7 0 1 5\n"

"1 0 9 2 0 4 6 8 0\n";

[Link](puzzle);

[Link]();

[Link]();

return 0;

B) suduko.h

#pragma once

#ifndef _SUDOKU_H_

#define _SUDOKU_H_
#include <vector>

#include <iostream>

#include "cell.h"

#include <sstream>

using std::vector;

class Sudoku

private:

std::vector<std::vector<Cell>> grid;

size_t row;

size_t col;

public:

Sudoku(size_t r = 9, size_t c = 9) : row(r), col(c), grid(r, vector<Cell>(c)) {

initRegions();

void initRegions();

bool checkEnd();

bool checkForPairs();

bool setCandidates();

bool singleFinder();

bool checkLoners();

void solve();

void readIn(const std::string& s);

void print() const;

vector<Cell>& getRegionVector(const size_t& idx);

Cell* getRegion(const size_t& idx);

vector<Cell>& getRegionVector(const size_t& idx1, const size_t& idx2);

Cell* getRegion(const size_t& idx1, const size_t& idx2);


bool sameRow(const Cell& c1, const Cell& c2) const;

bool sameCol(const Cell& c1, const Cell& c2) const;

bool sameReg(const Cell& c1, const Cell& c2) const;

bool same(const Cell& c1, const Cell& c2) const;

};

C) cell.h

#pragma once

#include <vector>

#include <iostream>

using std::vector;

class Cell

private:

int val;

std::pair<unsigned, unsigned> region;

vector<bool> candidates;

unsigned rowPos;

unsigned colPos;

unsigned regPos;

public:

Cell() : val(-1), region(std::pair<unsigned, unsigned>(0, 0)), rowPos(0), colPos(0), regPos(0)

for (unsigned i = 0; i < 9; i++)

candidates.push_back(true);

Cell(const std::pair<unsigned, unsigned>& p) : val(-1), region(std::pair<unsigned, unsigned>([Link], [Link]))

for (unsigned i = 0; i < 9; i++)

candidates.push_back(true);

rowPos = [Link];
colPos = [Link];

regPos = getRegionSingle();

Cell(const int& i, const vector<bool>& c, const std::pair<unsigned, unsigned>& p) : val(i), candidates(c),


region(std::pair<unsigned, unsigned>([Link], [Link])) {}

void setIdx(const bool& b, const unsigned& num) { candidates[num] = b; }

bool getIdx(const unsigned& num) { return candidates[num]; }

void setVal(const int& v) { val = v; }

void setCandidates(const vector<bool>& c) { candidates = c; }

void setRegion(const std::pair<unsigned, unsigned>& p) { region = p; }

void setRow(const unsigned& param) { rowPos = param; }

void setCol(const unsigned& param) { colPos = param; }

void setReg(const unsigned& param) { regPos = param; }

vector<bool>& getCandidates() { return candidates; }

int getVal() const { return val; }

std::pair<unsigned, unsigned> getRegion() const { return region; }

unsigned getRow() const { return rowPos; }

unsigned getCol() const { return colPos; }

unsigned getReg() const { return regPos; }

bool operator==(const Cell& other) const

return val == [Link];

bool operator!=(const Cell& other) const

return !(*this == other);

Cell& operator=(const Cell& other)// Assignment operator

// Self-assignment check

if (this == &other) {

return *this;
}

// Copy each field from the other Cell object

val = [Link];

candidates = [Link];

region = [Link];

return *this; // Return a reference to the current object

static void* operator new(size_t size) // Custom new operator

std::cout << "Allocating memory for a Cell object of size " << size << std::endl;

void* ptr = malloc(size);

if (!ptr) {

throw std::bad_alloc(); // Ensure that failure to allocate memory is handled

return ptr;

static void operator delete(void* ptr) // Custom delete operator

std::cout << "Deallocating memory for a Cell object" << std::endl;

free(ptr);

int getNumberOfCandidates()

int counter = 0;

for (int i = 0; i < 9; i++)

if (candidates[i])

counter++;

return counter;

unsigned getRegionSingle()

if (region == std::pair<unsigned, unsigned>{0, 0})


return 0;

if (region == std::pair<unsigned, unsigned>{0, 1})

return 1;

if (region == std::pair<unsigned, unsigned>{0, 2})

return 2;

if (region == std::pair<unsigned, unsigned>{1, 0})

return 3;

if (region == std::pair<unsigned, unsigned>{1, 1})

return 4;

if (region == std::pair<unsigned, unsigned>{1, 2})

return 5;

if (region == std::pair<unsigned, unsigned>{2, 0})

return 6;

if (region == std::pair<unsigned, unsigned>{2, 1})

return 7;

if (region == std::pair<unsigned, unsigned>{2, 2})

return 8;

};

OUTPUT:-
The project Suduko solver was created to automatically solve suduko by using c++ and other coding
languages. This project is very important to test your conceptual knowledge.

Data Structures and Algorithms - Self-Paced Course


Course Summary
Congratulations on completing the Data Structures and Algorithms (DSA) self-paced course!

In this course, you’ve explored a wide range of topics, from basic data structures like arrays and linked
lists to advanced algorithms such as dynamic programming and graph traversal. Let’s recap what you’ve
achieved:

1. Foundations:

o Mastered arrays, linked lists, stacks, and queues.

o Understood the importance of choosing the right data structure for specific problems.

2. Sorting and Searching:

o Implemented sorting algorithms (bubble sort, merge sort, quicksort).

o Explored binary search and its variants.


3. Trees and Graphs:

o Delved into binary trees, binary search trees, and heaps.

o Navigated through graphs using BFS and DFS.

4. Dynamic Programming:

o Solved complex problems using dynamic programming techniques.

o Learned to optimize recursive solutions.

5. Practice and Challenges:

o Participated in quizzes, contests, and assessment tests.

o Strengthened your problem-solving skills.

Recommendations
1. Keep Practicing:

o Continue solving coding problems regularly.

o Explore additional challenges on platforms like LeetCode and HackerRank.

2. Apply DSA Concepts:

o Apply the knowledge gained in real-world scenarios.

o Consider contributing to open-source projects or participating in coding competitions.

3. Stay Curious:

o Technology evolves rapidly. Keep learning and adapting.

Acknowledgments
I’d like to express my gratitude to the GeeksforGeeks team, industry experts, and fellow learners who
made this course possible. Your dedication and hard work have empowered us all.

Conclusion
Remember that learning is a journey, not a destination. Keep exploring, stay curious, and happy coding!

You might also like