🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c.moderated
Article #2038

Re: Good C Interview questions?

#2038
From: J. Kanze
Date: Sat, 17 Feb 1996 17:52
30 lines
1886 bytes
In article <4fu8m9$9oh@solutions.solon.com> Gene Gorokhovsky
<geneg@kandasoft.com> writes:

> Christopher R Volpe wrote:
> : 
> : James Hu wrote:
> : > >>>>> In article <4fa794$2lb@solutions.solon.com>,
> : > >>>>> "Gene" == Gene Gorokhovsky <geneg@kandasoft.com> writes:
> : >
> : > [ Find the number that appears twice in a list of N numbers which
> : >   contain all numbers from 1..N-1 in linear time, using constant
> : >   addtional space. ]
> : 
> : Any bounds on N here? Is this a general algorithms question where N can
> : grow arbitrarily large? Or are we relying upon C-specifig things, like
> : fitting everything in an unsigned long?
> 
> The original problem was formulated with N=100. I would not give
> any points off for assuming N is unsigned short.

I don't think that was the point.  I think that most of the algorithms
proposed would fail if the array was an array of int's, and most of the
values in it were close to INT_MAX.  The worst thing about it, of
course, is that on most implementations, they would fail silently, just
giving the wrong results.
-- 
James Kanze           (+33) 88 14 49 00          email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs Bourgeois, 67000 Strasbourg, France
Conseils, études et réalisations en logiciel orienté objet --
              -- A la recherche d'une activité dans une region francophone
Technical Details
Message-ID: <4g54ko$afj@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4ec3vg$lst@solutions.solon.com> <4fa794$2lb@solutions.solon.com><4fbfu6$9mv@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: kanze@gabi.gabi-soft.fr (J. Kanze)
Newsgroups: comp.lang.c.moderated
Subject: Re: Good C Interview questions?
Date: 17 Feb 1996 11:52:23 -0600
Organization: GABI Software, Sarl.
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4g54ko$afj@solutions.solon.com>
References: <4ec3vg$lst@solutions.solon.com>
 <4fa794$2lb@solutions.solon.com><4fbfu6$9mv@solutions.solon.com>
NNTP-Posting-Host: solutions.solon.com