Cookie Clicker Alpha – Problem B – Google Code Jam 2014 Qualification Round

Introduction

(Link to Question Page in Code Jam Website)
Cookie Clicker is a Javascript game by Orteil, where players click on a picture of a giant cookie. Clicking on the giant cookie gives them cookies. They can spend those cookies to buy buildings. Those buildings help them get even more cookies. Like this problem, the game is very cookie-focused. This problem has a similar idea, but it does not assume you have played Cookie Clicker. Please don’t go play it now: it might be a long time before you come back.

Continue reading “Cookie Clicker Alpha – Problem B – Google Code Jam 2014 Qualification Round”

Magic Trick – Problem A – Google Code Jam 2014 Qualification Round

Problem (Link to Question Page in Code Jam Website)

Recently you went to a magic show. You were very impressed by one of the tricks, so you decided to try to figure out the secret behind it!

The magician starts by arranging 16 cards in a square grid: 4 rows of cards, with 4 cards in each row. Each card has a different number from 1 to 16 written on the side that is showing. Next, the magician asks a volunteer to choose a card, and to tell him which row that card is in.

Continue reading “Magic Trick – Problem A – Google Code Jam 2014 Qualification Round”

Linked List with Read-Write Locks for the Entire Linked List

Implementation of a linked list as a Parallel program (based on Pthreads) with read-write locks for the entire linked list

https://github.com/Rajind/LinkedLists-in-C

Continue reading “Linked List with Read-Write Locks for the Entire Linked List”

Solution to Senate Bus Problem

This is Java Implementation of the Semaphore based solution for Senate Bus Problem

https://github.com/Rajind/SenateBusProblem

The Senate Bus Problem (From The Little Book of Semaphores by Allen B. Downey)

This problem was originally based on the Senate bus at Wellesley College. Riders come to a bus stop and wait for a bus. When the bus arrives, all the waiting riders invoke boardBus, but anyone who arrives while the bus is boarding has to wait for the next bus. The capacity of the bus is 50 people; if there are more than 50 people waiting, some will have to wait for the next bus. When all the waiting riders have boarded, the bus can invoke depart. If the bus arrives when there are no riders, it should depart immediately.

Continue reading “Solution to Senate Bus Problem”