Introduction

This is my blog of programming, I take notes and leave codes of computer science problems I solved here. Be my guest to comment :)

Wednesday, October 16, 2013

Uva 10765 - Doves and bombs

  1  /*
  2  Problem link
  3  Type: Graph - Find articulation points
  4  Algorithm:

Tuesday, September 17, 2013

Thursday, September 12, 2013

UVa 11747 - Heavy Cycle Edges

  1  /*
  2  Problem type: Graph - MST
  3  Algorithm: Find the Minimum Spanning Tree (MST) (using Kruskal,
  4      Prim) and print out all the edges which are not included in the MST.
  5  */

Wednesday, July 10, 2013

Friday, June 21, 2013

Wednesday, June 19, 2013

Monday, June 17, 2013

Tuesday, May 28, 2013

Monday, May 20, 2013

Sunday, April 14, 2013

Tuesday, April 9, 2013

uva 11733 - Airports


 1 /*
 2  Problem link
 3  Type: Graph
 4  Algorithm:
 5      Kruskal, stop when the number of edge selected is equal to n-1 or the price of the edge
 6      equal to the cost to build an airport.
 7  */

Wednesday, March 27, 2013

Monday, March 18, 2013

Thursday, March 14, 2013

Monday, March 4, 2013

Thursday, February 28, 2013

Tuesday, February 26, 2013

Monday, February 25, 2013

Red - black tree full implementation

Red-black tree is known for an efficient data structure use in computer science. It is a type of self-balance binary search tree, it performs insertion, deletion, searching,.. in the worst running time of O(lg n). This is my red-black tree implementation in C++:

Friday, February 22, 2013

Tuesday, February 19, 2013

Thursday, February 7, 2013

uva 10306 - e-Coins


 1  /*
 2  Problem link
 3  Type: DP - Coins change
 4  Algorithm:
 5      First I use the function getP to search for a list of possible points with
 6       length = s from the origin and have possitive coordinates.
 7      Use the coins change algorithm (uva 166) with a few changes to find the
 8       minimum step to each point i got. Get the minimum for each point result.
 9  */

Wednesday, January 30, 2013

uva 10278 - Fire Station

  1 /*
  2  Problem link
  3  Type: Graph - Single source shortest path
  4  Algorithm:
  5      First run Floyd (or Dijkstra to every vertex n), for each vertex
  6      find the distance to the nearest station, get the max of those nearest station.
  7  
  8      For the vertex which is not a station, place a station there and run Dijkstra
  9      for that vertex. Recalculate the distance to the nearest station for each vertex
 10      by the distance array from the Dijkstra and update the for the "better max".
 11  */

uva 100 - The 3n + 1 problem

/*
Problem link
Type: Adhoc
Algorithm: Straight forward 
*/ 

Wednesday, January 23, 2013

Tuesday, January 22, 2013

Thursday, January 17, 2013

Wednesday, January 2, 2013

uva 821 - Page Hopping


 1 /*
 2  Problem link
 3  Type: Graph
 4  Algorithm:
 5      Use floyd to find all pair shortest path, sum them up, divide to the number of pair
 6      I use the map to mark for the vertex in the input.
 7  */

Tuesday, January 1, 2013

uva 423 - MPI Maelstrom


 1 /*
 2  Problem link
 3  Type: Graph
 4  Algorithm:
 5      Use Floyd or Dijkstra to find the shortest path from 1 to n-1 others nodes.
 6      Find the max of the shortest path from 1 to n-1 others nodes.
 7  */