Category Archives: Home

Interesting Programming Challenge–FIFO Queue

I recently came across an interesting programming challenge, which I can summarise here.

Develop a first-in/first-out (FIFO) queue in a programming language of your choice. The following constraints apply:

  1. You must use a linked-list, and can’t use arrays, hashes or other sophisticated enumerations;
  2. The queue must be able to accept and store arbitrary objects;
  3. If the queue is empty, popping should raise an exception
  4. Each method/function can only be one line long (and using multi-statement separators such as ‘;’ is cheating);
  5. Each line can be at most 80 characters long;
  6. You can’t use an external or additional libraries – core language features only.

The queue should implement the following public interface:

  • size() –> returns an integer representing the number of elements in the queue
  • push(object o) –> pushes an arbitrary object o onto the end of the queue
  • pop() –> returns the next object from the head of the queue; raises an exception if there are no objects on the queue

While implementing a FIFO queue as a linked list is a fairly typical first year CS undergraduate problem, the additional constraints, in particular #4, make it much more interesting.

I chose to implement the solution in Ruby. Here’s the test spec for the solution:

As an added challenge, although it’s almost dictated by the problem statement, I tried to minimise (or indeed, ideally, eliminate) the use of ‘if’ statements.

Check-out my solution by clicking through.

Continue reading

Related Posts:

US Congress killing medical research?

Forbes has an interesting opinion piece on how the on-going budget debate (debacle, depending on your political leanings) in the US is “killing medical research”. In particular, because of relative small budget cuts, new grants cannot get issued, and hence the whole system begins to grind to a halt.

Every year, many NIH projects end and many others begin.  (Most only last 3 or 4 years.)  But not this year.  Because of the budget shenanigans, NIH has been forced to cut or delay funding to almost all new projects.  In other words, biomedical research that has already gone through rigorous peer review and been given top priority is on hold.  And just to be clear: these are only the best projects.  80-85% of projects submitted to NIH, many of them excellent, don’t make the cut because NIH just doesn’t have enough funding for them.

Related Posts:

  • No Related Posts

ReadWrite on Ireland as a startup hub

There’s a brief, but interesting piece in ReadWrite entitled “Can Ireland Offer Startups Something Silicon Valley Can’t?

It’s a short, but interesting piece on how EI is positioning itself to support not just home-grown start-ups, but international ones that choose to launch or base themselves in Ireland.

Related Posts:

  • No Related Posts

New chairperson for the Irish Research Council

The Irish Times reports that Prof. Orla Feeley, a UCD research engineer, has been appointed as the chair of the Irish Research Council (IRC). The IRC is the merger of the former Irish Research Council for Science, Engineering and Technology (IRCSET) and the Irish Research Council for Humanities and Social Sciences (IRCHSS).

Orla is an SFI award holder, and conducts her research in the area of electronic circuits. She holds a 2011 SFI Principal Investigator award entitled “Nonlinear effects in circuits and systems; analysis, control and applications”.

Congratulations to Orla on this great appointment.

Related Posts:

Paul Graham on Startups

Paul Graham, to those unfamiliar with him, is a blogger/essayist, as well as the founder of Y Combinator, one of the most innovative (and successful) micro venture funds.

In hist most recent essay, entitled “Startup = Growth“, he writes about the ecosystem of startups, venture funding and acquisition. It’s a really excellent essay from one of the deep thinkers and writers on the topic, and is a counter argument to David Heinemeier Hansson’s oft reported view of the venture world, whereby taking VC is the poisoned chalice, and companies are selling their souls if they do so.

Of course, DHH (as he’s affectionately known) is himself enormously successful, having created Ruby on Rails, and helped to build the archetypical Web 2.0 boot-strap company, 37signals, so his experience can’t be easily written off.

The answer, of course, is that both approaches are perfectly valid, and it’s up to each company and founder to decide which route is more appropriate.

Graham’s key point in Startup = Growth is that taking VC funding allows a company to decide what it’s growth rate is going to be (this, of course, presumes that there’s a linear relationship between capital and growth, but Graham neatly skips over that point).

Almost every company needs some amount of funding to get started. But startups often raise money even when they are or could be profitable. It might seem foolish to sell stock in a profitable company for less than you think it will later be worth, but it’s no more foolish than buying insurance. Fundamentally that’s how the most successful startups view fundraising. They could grow the company on its own revenues, but the extra money and help supplied by VCs will let them grow even faster. Raising money lets you choose your growth rate.

In any event, check out Startup = Growth – though provoking and well worth a read.

Related Posts:

  • No Related Posts

2012 Thesis in 3

The 2012 Thesis in 3 competition is due in a few weeks time: October 25th @ 7pm in Smock Alley Theatre, Dublin 8, to be precise.

I’ve written about this event before, but for those who don’t know, it’s a competition where SFI-funded PhD and MSc students who are members of one of our CSETs get to present their thesis research work “elevator-pitch style” in three minutes, using three slides (hence the name). The idea is that the students have to be able to describe their research, which is by its nature complex and cutting-edge, in a fashion that’s understandable and interesting to the general public.

I was a judge last night at the CLARITY event, in which 15 CLARITY students did their pitch, and the winning two go forward to the national final on October 25.

Congratulations to Matt Patterson and Deirdre Cogan of UCD and DCU respectively for making it through to the final.

The Thesis in 3 event is open to the public, and is a great opportunity for members of the public to go along and understand what type of research our up-and-coming intellectual talent is working on, and how the research investment being made by the State is being put to work.

Related Posts:

KantanMT hackathon

Wow! It’s been almost 6 months since my last post! That’s a record of inactivity even for me.

Anyway, a quick post to highlight a hackathon being organised this weekend for a new start-up called Xcelerator. Xcelerator has developed a technology/service called KantanMT, which is a “cloud-based machine translation service for the localisation industry”.

Xcelerator is a spin-out company from the SFI-funded Centre for Next Generation Localisation (CNGL). It’s being headed up by Tony O’Dowd, a seasoned campaigner in the localisation and globalisation industries, so has great prospects of success.

If you’re a software developer looking to get in on the ground floor of an exciting start-up, check out the details of the recruitment hackathon on their website.

Related Posts:

  • No Related Posts

What to Say to Programme Officers

There’s an interesting article in The Chronicle of Higher Education entitle “What to Say – and Not Say – to Program Officers” [of funding agencies].

There’s plenty of interesting advice here. I’m not sure that all of it is applicable to SFI, as we’re a much smaller agency to the NSF, and therefore, I believe, much more approachable. Nevertheless, readers of this blog might find some words of wisdom there.

Best bit of advice, in my opinion?

First, and most important, do your homework. Before reaching out with a question, seek out the answer on your own. Check the agency’s or program’s Web site, review the applicable guidelines, or contact your institution’s sponsored-research office. You may well find the answer in one of those places—and if you don’t, you’ll at least be able to frame the question more thoroughly.

You’ll also demonstrate that you’ve done your due diligence. Agencies revise their grant-making priorities, program guidelines, and staff assignments fairly regularly, so make sure that you’re working with the most current information available. What was OK last year may not be OK now (or vice versa), and the person you dealt with last time may have left or changed jobs. A bit of preparation beforehand will save time and potential embarrassment later.

And for those that are not successful in their grant applications:

Finally, if the program officer has to say no—and that will happen a lot—there are a couple of things to remember, whether that no applies to a request you’ve made or to your entire proposal. The first is that while program officers often have considerable discretion, they are nevertheless bound by rules that they probably didn’t make themselves. Be courteous even though you’re disappointed.

But don’t let your disappointment rob you of the chance to do better next time. Read any comments you received about the proposal; then put the whole thing aside for a few days or weeks. When you’re over the sting of the rejection, go back and reread the comments. Then call the program officer to discuss them and to ask how you could make the proposal better next time.

Related Posts:

NSF Innovation Corps

Steve Blank, an entrepreneur, investor and educator from Stanford writes about the US National Science Foundation (NSF) Innovation Corps on his blog.

This is an extremely interesting idea, and one which is somewhat similar, albeit on a larger scale, to our ownTechnology Innovation Development Award (TIDA) programme. As he describes it, the NSF Innovation Corps is an incubator for scientists, where they take their basic research developments and look at commercialization opportunities, and ultimately to prepare them to attract external private (Venture Capital) funding.

63 scientists and engineers in 21 teams made ~2,000 customer calls in 10 weeks, turning laboratory ideas into formidable startups. 19 of the 21 teams are moving forward in commercializing their technology.

The 3-person teams consisted of Principal Investigators (PI’s), mostly tenured professors (average age of 45,) whose NSF research the project was based on. The PI’s in turn selected one of their graduate students (average age of 30,) as the entrepreneurial lead. The PI and Entrepreneurial Lead were supported by a mentor (average age of 50,) with industry/startup experience.

Related Posts: