Article View: comp.lang.c.moderated
Article #1976Re: Good C Interview questions?
From: Eivind Eklund
Date: Thu, 15 Feb 1996 03:13
Date: Thu, 15 Feb 1996 03:13
20 lines
1628 bytes
1628 bytes
In article <4fp1eg$gu3@solutions.solon.com>, Christopher R Volpe <volpe@ash.crd.ge.com> writes: >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? Given that you cannot use anything larger than an unsigned long to index the array, that constraint is pretty much nescessary, isn't it? I took about 30 seconds to find an algorithm that is linear as long as random access is in a constant time. If it isn't, then I cannot see anything smart. (Ie, if these numbers are on tape, the best way I can see is to sort them through a merge sort.) I assume people do not want the actual answers posted here, so just e-mail me for a solution. Hint: The average case should detect the duplicate after inspection of *half* the numbers. -- Eivind Eklund / Job: eivind@funcom.com / Personal: perhaps@yes.no FUNCOM don't speak for me, and I return the courtesy. Message from our sponsor, NSA: ``You are not using DES. Please stop it.''
Technical Details
Message-ID:
<4fu8db$9kk@solutions.solon.com>Path:
arc1-ca.pugleaf.net!solon.com!not-for-mailReferences:
<4ec3vg$lst@solutions.solon.com> <4fa794$2lb@solutions.solon.com> <4fbfu6$9mv@solutions.solon.com> <4feo78$479@solutions.solon.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail From: eivind@funcom.no (Eivind Eklund) Newsgroups: comp.lang.c.moderated Subject: Re: Good C Interview questions? Date: 14 Feb 1996 21:13:47 -0600 Organization: Funcom Productions. Sender: clc@solutions.solon.com Approved: clc@solutions.solon.com Message-ID: <4fu8db$9kk@solutions.solon.com> References: <4ec3vg$lst@solutions.solon.com> <4fa794$2lb@solutions.solon.com> <4fbfu6$9mv@solutions.solon.com> <4feo78$479@solutions.solon.com> NNTP-Posting-Host: solutions.solon.com X-Newsreader: knews 0.9.5