Sunday, October 30, 2016

Codeforces problem B Two Buttons analysis

Problem Type : BFS , math , greedy , shortest path

Problem link: Two Buttons


this was a very interesting for me.


This problem asks us what is the minimum steps we need to reach from one given number to another given number by multiplying by 2 or  subtracting 1


i have found 2 ways to solve this problem 

       1) using bfs (hard way)
       2) simple mathematics

The hard way:


let us try to analyze 2 given test cases 


1)  4 ->6  minimum steps: 2

2) 10 ->1 minimum steps: 9

let us make a graph using the 2 test cases



Wednesday, October 26, 2016

UVA 383 - Shipping Routes analysis

Problem Type : Single-Source Shortest Paths On Unweighted Graph  (BFS/DFS)

Its a basic SSSP problem.

"The cost of a shipment is equal to the size of the shipment times the number of shipping legs required times $100."

we just have to do a bfs or dfs from given source if we have't done bfs or dfs on the source before.We can get the cost of the shipment using the above statement using the cost of the destination :D


Tuesday, October 25, 2016

UVA 260 - Il Gioco dell'X analysis

Problem Type : Finding Connected Components (BFS/DFS)

Let us try to understand the problem

"The game ‘Il Gioco dell’ X’ is played on a N by N board (N ≥ 2). The object of both players, say Black and White, is to join opposite sides of the board by placing in turn their pawns on the board in such a way that a path is made from one side to the other by adjacent (neighboring) pawns of their own color."

Though the statement is not very clear how Black and White will win but we can get the idea from the given picture



Saturday, October 22, 2016

Sifat Shishir's Blog: UVA 11254 : Consecutive Integers

Sifat Shishir's Blog: UVA 11254 : Consecutive Integers: Prob link : https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=22...

Friday, October 14, 2016

Depth-first search Implementation

1 thing i always remember about dfs is "Using dfs We go to the depth of a node and then we come back"

I learned dfs from my friend and from this blog shafaetsplanet . In shafaetsplanet the algorithm is explained very easily.


Algorithm :


Basic DFS Traversal of a Graph:


Here starting node is 0.



Some good beginner problems


IMPLEMENTATION:

01.Beautiful Year (L1)
Solution

02.Queue at the School (L1)
Solution

03.Lights Out (L1)
Solution

04.Arrival of the General (L1)
Solution

05.Twins (L1)
Solution

06.Effective Approach (L2)
Solution

07.Even Odds (L2)
Solution

08. Airport (L2)
Solution

EASY GREEDY:

01.Dragons (L2)
Solution

Monday, October 10, 2016

Problems on Data structures

Some Graph Problems

Here are some Graph problems i have solved over time 


Flood Fill/Finding Connected Components using dfs/bfs:



BFS:



DFS:




Tropological sort:


Strongly connected component:



Graph coloring:



MST:

908 - Re-connecting Computer Sites
Solution

11631 - Dark roads
Solution

11747 - Heavy Cycle Edges
Solution

10034 - Freckles
Solution

11733 - Airports
Solution

1174 - IP-TV
Solution

11710 - Expensive subway
Solution

11857 - Driving Range
Solution

10048 - Audiophobia (mst+bfs)
Solution

544 - Heavy Cargo
Solution

10099 - Tourist Guide
Solution

10147 - Highways
Solution

10397 - Connect the Campus
Solution

10600 - ACM Contest and Blackout
Solution

11228 - Transportation system.
Solution

11733 - Airports
Solution

11857 - Driving Range
Solution


Dijkstra:

10986 - Sending email
Solution

929 - Number Maze
Solution


bellman ford:

558 - Wormholes
Solution


Football Player Transfer Prediction

Football Player Transfer Prediction Using Different Classifiers Project Report :  Football Player Transfer Prediction Report ...