• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 14:28
CEST 20:28
KST 03:28
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
Team Liquid Map Contest #22 - The Finalists14[ASL21] Ro16 Preview Pt1: Fresh Flow9[ASL21] Ro24 Preview Pt2: News Flash10[ASL21] Ro24 Preview Pt1: New Chaos0Team Liquid Map Contest #22 - Presented by Monster Energy21
Community News
2026 GSL Season 1 Qualifiers11Maestros of the Game 2 announced32026 GSL Tour plans announced13Weekly Cups (April 6-12): herO doubles, "Villains" prevail1MaNa leaves Team Liquid22
StarCraft 2
General
2026 GSL Tour plans announced MaNa leaves Team Liquid Team Liquid Map Contest #22 - The Finalists Weekly Cups (April 6-12): herO doubles, "Villains" prevail Oliveira Would Have Returned If EWC Continued
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament GSL CK: More events planned pending crowdfunding 2026 GSL Season 1 Qualifiers Master Swan Open (Global Bronze-Master 2) SEL Doubles (SC Evo Bimonthly)
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players [M] (2) Frigid Storage
External Content
The PondCast: SC2 News & Results Mutation # 521 Memorable Boss Mutation # 520 Moving Fees Mutation # 519 Inner Power
Brood War
General
Data needed RepMastered™: replay sharing and analyzer site Gypsy to Korea ASL21 General Discussion BGH Auto Balance -> http://bghmmr.eu/
Tourneys
Escore Tournament StarCraft Season 2 [Megathread] Daily Proleagues [ASL21] Ro16 Group A [ASL21] Ro16 Group B
Strategy
Simple Questions, Simple Answers What's the deal with APM & what's its true value Any training maps people recommend? Fighting Spirit mining rates
Other Games
General Games
Nintendo Switch Thread General RTS Discussion Thread Battle Aces/David Kim RTS Megathread Stormgate/Frost Giant Megathread Starcraft Tabletop Miniature Game
Dota 2
The Story of Wings Gaming
League of Legends
G2 just beat GenG in First stand
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
Things Aren’t Peaceful in Palestine US Politics Mega-thread Russo-Ukrainian War Thread YouTube Thread Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
Anime Discussion Thread [Req][Books] Good Fantasy/SciFi books [Manga] One Piece Movie Discussion!
Sports
2024 - 2026 Football Thread McBoner: A hockey love story Formula 1 Discussion Cricket [SPORT]
World Cup 2022
Tech Support
[G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Reappraising The Situation T…
TrAiDoS
lurker extra damage testi…
StaticNine
Broowar part 2
qwaykee
Funny Nicknames
LUCKY_NOOB
Iranian anarchists: organize…
XenOsky
ASL S21 English Commentary…
namkraft
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1531 users

The Big Programming Thread - Page 376

Forum Index > General Forum
Post a Reply
Prev 1 374 375 376 377 378 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
EscPlan9
Profile Blog Joined December 2006
United States2777 Posts
October 19 2013 15:04 GMT
#7501
On October 19 2013 15:55 wherebugsgo wrote:
You're given an array of numbers such that every element in the array is duplicated except for one. Provide an efficient algorithm to determine the singleton element.


I probably would have given the hash table answer. Though I'm not sure if my implementation was the same as what you were describing:


var arr = [1,1,2,2,3,3,4];
var hash = {};

// build hash - give the value 1 when initially found, and add 1 for each duplicate
for (var i = 0; i < arr.length; i++) {
if (hash[ arr[i] ] {
hash[ arr[i] ] = 1 + hash[ arr[i] ];
} else {
hash[ arr[i] ] = 1;
}
}

// iterate through hash until found a key with a value of 1 indicating no duplicates
for (var k in hash) {
if (hash[k] === 1) {
print "Unique element found: " + k;
}
}


What would be pseudocode for your implementation you mentioned with keeping track of a separate sum variable? I just used the value of the hash-key as the "sum".
Undefeated TL Tecmo Super Bowl League Champion
freelander
Profile Blog Joined December 2004
Hungary4707 Posts
Last Edited: 2013-10-19 15:16:21
October 19 2013 15:14 GMT
#7502
please help with c++ (templates + friends).
I'm getting the following error:
+ Show Spoiler +
C:\semester\OAF\2\bag\include\bag.h|34|warning: friend declaration 'std::ostream& operator<<(std::ostream&, const Bag<T>&)' declares a non-template function|
C:\semester\OAF\2\bag\include\bag.h|34|note: (if this is not what you intended, make sure the function template has already been declared and add <> after the function name here) |
C:\semester\OAF\2\bag\include\bag.h||In function 'std::ostream& operator<<(std::ostream&, const Bag<T>&)':|
C:\semester\OAF\2\bag\include\bag.h|149|error: 'curr' was not declared in this scope|
||=== Build finished: 1 errors, 1 warnings ===|


my multiset class (implemented with a single linked ordered list):
+ Show Spoiler +
template <class T>
class Bag{
private:

struct Node{
T val;
unsigned int mult;
Node *next;

Node(T e, unsigned int m=1)
:val(e), next(0), mult(m){}

Node(T e, Node *n, unsigned int m=1)
:val(e), next(n), mult(m){}
};

Node * head;

public:
Bag();
Bag (const Bag<T>& b);
virtual ~Bag();

bool is_empty();
void insert(T e, unsigned int n=1);
void erase(T e);
bool contains(T e);
unsigned int count(T e);

friend std::ostream& operator<<(std::ostream& os, const Bag<T>& b);
};


the << operator's definition:
+ Show Spoiler +
template <class T>
std::ostream& operator<<(std::ostream& os, const Bag<T> &b){
os << "{ ";
Bag<T>::Node* curr=b.head;
while (curr){
//...
}
os << " }";
return os;
}


I don't get it. I declared the variable 'curr' (a pointer for iterating the list's nodes) right there.
And all is illuminated.
Amnesty
Profile Joined April 2003
United States2054 Posts
October 19 2013 15:38 GMT
#7503
On October 20 2013 00:14 freelander wrote:
please help with c++ (templates + friends).
I'm getting the following error:
+ Show Spoiler +
C:\semester\OAF\2\bag\include\bag.h|34|warning: friend declaration 'std::ostream& operator<<(std::ostream&, const Bag<T>&)' declares a non-template function|
C:\semester\OAF\2\bag\include\bag.h|34|note: (if this is not what you intended, make sure the function template has already been declared and add <> after the function name here) |
C:\semester\OAF\2\bag\include\bag.h||In function 'std::ostream& operator<<(std::ostream&, const Bag<T>&)':|
C:\semester\OAF\2\bag\include\bag.h|149|error: 'curr' was not declared in this scope|
||=== Build finished: 1 errors, 1 warnings ===|


my multiset class (implemented with a single linked ordered list):
+ Show Spoiler +
template <class T>
class Bag{
private:

struct Node{
T val;
unsigned int mult;
Node *next;

Node(T e, unsigned int m=1)
:val(e), next(0), mult(m){}

Node(T e, Node *n, unsigned int m=1)
:val(e), next(n), mult(m){}
};

Node * head;

public:
Bag();
Bag (const Bag<T>& b);
virtual ~Bag();

bool is_empty();
void insert(T e, unsigned int n=1);
void erase(T e);
bool contains(T e);
unsigned int count(T e);

friend std::ostream& operator<<(std::ostream& os, const Bag<T>& b);
};


the << operator's definition:
+ Show Spoiler +
template <class T>
std::ostream& operator<<(std::ostream& os, const Bag<T> &b){
os << "{ ";
Bag<T>::Node* curr=b.head;
while (curr){
//...
}
os << " }";
return os;
}


I don't get it. I declared the variable 'curr' (a pointer for iterating the list's nodes) right there.


template<class T>
friend std::ostream& operator<<(std::ostream& os, const Bag<T>& b);
The sky just is, and goes on and on; and we play all our BW games beneath it.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
Last Edited: 2013-10-19 15:44:25
October 19 2013 15:40 GMT
#7504
On October 20 2013 00:14 freelander wrote:
please help with c++ (templates + friends).
I'm getting the following error:
+ Show Spoiler +
C:\semester\OAF\2\bag\include\bag.h|34|warning: friend declaration 'std::ostream& operator<<(std::ostream&, const Bag<T>&)' declares a non-template function|
C:\semester\OAF\2\bag\include\bag.h|34|note: (if this is not what you intended, make sure the function template has already been declared and add <> after the function name here) |
C:\semester\OAF\2\bag\include\bag.h||In function 'std::ostream& operator<<(std::ostream&, const Bag<T>&)':|
C:\semester\OAF\2\bag\include\bag.h|149|error: 'curr' was not declared in this scope|
||=== Build finished: 1 errors, 1 warnings ===|


my multiset class (implemented with a single linked ordered list):
+ Show Spoiler +
template <class T>
class Bag{
private:

struct Node{
T val;
unsigned int mult;
Node *next;

Node(T e, unsigned int m=1)
:val(e), next(0), mult(m){}

Node(T e, Node *n, unsigned int m=1)
:val(e), next(n), mult(m){}
};

Node * head;

public:
Bag();
Bag (const Bag<T>& b);
virtual ~Bag();

bool is_empty();
void insert(T e, unsigned int n=1);
void erase(T e);
bool contains(T e);
unsigned int count(T e);

friend std::ostream& operator<<(std::ostream& os, const Bag<T>& b);
};


the << operator's definition:
+ Show Spoiler +
template <class T>
std::ostream& operator<<(std::ostream& os, const Bag<T> &b){
os << "{ ";
Bag<T>::Node* curr=b.head;
while (curr){
//...
}
os << " }";
return os;
}


I don't get it. I declared the variable 'curr' (a pointer for iterating the list's nodes) right there.

You probably should first resolve your warnings. It's been a while since I worked with templates and friends, and they certainly are a bit tricky to deal with. This link might help you though, the example implements an
friend std::ostream& operator<< (std::ostream& o, const Foo<T>& x);

(it basically boils down to what Amnesty posted, but there is a bit of an explanation provided as well)

With templates it is not rare that the actual error is reported as a warning.
If you have a good reason to disagree with the above, please tell me. Thank you.
DeltaX
Profile Joined August 2011
United States287 Posts
October 19 2013 15:47 GMT
#7505
On October 19 2013 20:07 wherebugsgo wrote:
Show nested quote +
On October 19 2013 16:33 spinesheath wrote:
On October 19 2013 15:55 wherebugsgo wrote:
You're given an array of numbers such that every element in the array is duplicated except for one. Provide an efficient algorithm to determine the singleton element.

Is that the exact wording of the question? Does "duplicated" mean that the duplicate and the original are in unrelated slots of the array, or are they adjacent? Can there be multiple sets of duplicates of the same number, as in 2, 4, 6 of the number? What range are the numbers from?

Then there also is the question how one defines efficient. It's an inefficient use of programmer time if you don't just use some stupid algorithm that works and is easy to read and understand. Unless that piece of code is a performance bottleneck that needs to be faster. But I'm going to assume that low execution time is the goal here anyways.


I paraphrased, but basically you can expect to encounter two of every element in the array except for one element. The array is unsorted and the duplicates can appear anywhere. There won't be multiple (read: more than 2) instances of the same number, though the answer would remain the same for even-number duplicates-i.e. you could have 4 of the same number and 2 of another and 6 of another and finding the singleton still works the same.

There is no specification on the range of the numbers, though you can assume that you won't need multiple data structures to represent a single number. i.e. if it makes it easier for you, assume they are 32 bit ints or whatever.

My first solution required O(nlogn) time, and O(1) space. I pretty quickly realized that the time complexity can be improved to O(n) time and there's a relatively simple way of doing that by adding a data structure that takes O(n) space, but the "brilliant" answer (as the interviewer described it-I'd call it elegant) requires no additional space and is also O(n) time.

+ Show Spoiler [my shitty answer] +
Sort the array, then step through the array until you find that two consecutive elements are not the same. Sorting takes O(nlogn) time and stepping through the array takes O(n) time; O(nlogn + n) is in O(nlogn).

You could use radix sort and get an O(n) sort, I suppose.


+ Show Spoiler [an approximately equally shitty answer] +
Instead of sorting the array, maintain a hash table and a second sum variable. Iterate through the array and for each integer, check if it's in the hash table. If it isn't, then add it to the sum, and store it. If it is, then subtract it from the sum. When we've gone through the entire array, the singleton is the only element we never subtracted, thus the sum variable is the singleton.

This works in O(n) time since hash accesses are O(1), and we need O(n) space for the hash table.


+ Show Spoiler [the model answer] +

Just iterate through the array and XOR everything together. A[0] XOR A[1] XOR .... XOR A[n]. The result of this computation is the singleton element.

This works since XOR is commutative and associative. a XOR a is just 0, and 0 XOR a is a. Since all of the elements are duplicated except one of them, all the duplicates will XOR out to 0 and then the singleton will be left at the end.

This holds true also for arrays in which you have even multiples of elements, not just duplicates, though it fails when there are odd multiples.


If you guys like this sort of stuff or need interview practice, here's a few more interesting problems I encountered at career fairs/interviews and company visit sessions:

1. This problem is similar to the one I posed before, but it has a pretty major twist.

The problem statement is to find the missing integer in the array with the following rules:

a. An array A contains every integer from 0 to N except for one of them.
b. The elements of the array A may appear in any order.
c. We can't actually access an entire element of the array all at once. In other words if you index the array you won't get back the whole element. + Show Spoiler +
in other words, normally if you access an array element at index i, you would call A[i] and you would be returned the element at the ith position in A. In this problem you can't do that.
Instead, what you can do is ask for the jth bit of the ith element of the array. In other words, I could ask for the 4th bit of the first element of A, and I would be returned the bit in the 4th position of the element ordinarily given by A[0].
d. The algorithm must return the missing integer by looking through at most O(N) bits.




2. Give an approach (or code) to writing an equivalent of the C function atoi. + Show Spoiler +
I've also been asked how to implement strlen
If you're not a C programmer, atoi is a function that converts an ASCII string to an integer. Describe the limitations or shortcomings of your approch (or code) in as much detail as you can.




3. Suppose we have a function that computes rand2() (i.e. a fair coin toss-it outputs 1 or 2 with equal probability). Design an algorithm that uses this function to simulate a fair die roll, i.e. a function that should output a random number from 1 to 6 with equal probability.



I don't think that an approach using a hashset or hashmap is really all that bad. It could easily be extended to different amounts (3 of each, find the 5 that have 7 instead) and it would be much easier for people to understand what you are doing.

Mostly tho I came from a math background instead of CS, so XOR is not an operation I have ever really had to use or learn about it and its uses.

As for the other problems:
+ Show Spoiler [1] +
I would sum the array bit by bit and then missing = (n*(n+1))/2 - total. Should still be O(n) time as you inspect a constant 32 bits per number. Can be a bit more efficient by inspecting each bit until you get the maximum number of 0's or 1's it can have for n, so you know what that bit is in n. Then just keep moving to the next bit up until you determine n.

+ Show Spoiler [2] +
For atoi, is there a requirement that you are given ASCII characters that are numbers or does it have to work for any character? I think you want to do (psudo code):

int runningTotal = 0
for each char in string
if(charCode.isNumber)
runningTotal *= 10
runningTotal += charCode - codeOfZero
else
//do something for non-number character

You would also want to take into account whitespace and +- too.
For strlen, I think you just count the number of characters in the char[] until you hit the end of string character.

+ Show Spoiler [3] +
Call rand 3 times and use one result per bit. If you rolled a 0 or 7, reroll
freelander
Profile Blog Joined December 2004
Hungary4707 Posts
Last Edited: 2013-10-19 16:34:50
October 19 2013 15:53 GMT
#7506
On October 20 2013 00:40 spinesheath wrote:
Show nested quote +
On October 20 2013 00:14 freelander wrote:
please help with c++ (templates + friends).
I'm getting the following error:
+ Show Spoiler +
C:\semester\OAF\2\bag\include\bag.h|34|warning: friend declaration 'std::ostream& operator<<(std::ostream&, const Bag<T>&)' declares a non-template function|
C:\semester\OAF\2\bag\include\bag.h|34|note: (if this is not what you intended, make sure the function template has already been declared and add <> after the function name here) |
C:\semester\OAF\2\bag\include\bag.h||In function 'std::ostream& operator<<(std::ostream&, const Bag<T>&)':|
C:\semester\OAF\2\bag\include\bag.h|149|error: 'curr' was not declared in this scope|
||=== Build finished: 1 errors, 1 warnings ===|


my multiset class (implemented with a single linked ordered list):
+ Show Spoiler +
template <class T>
class Bag{
private:

struct Node{
T val;
unsigned int mult;
Node *next;

Node(T e, unsigned int m=1)
:val(e), next(0), mult(m){}

Node(T e, Node *n, unsigned int m=1)
:val(e), next(n), mult(m){}
};

Node * head;

public:
Bag();
Bag (const Bag<T>& b);
virtual ~Bag();

bool is_empty();
void insert(T e, unsigned int n=1);
void erase(T e);
bool contains(T e);
unsigned int count(T e);

friend std::ostream& operator<<(std::ostream& os, const Bag<T>& b);
};


the << operator's definition:
+ Show Spoiler +
template <class T>
std::ostream& operator<<(std::ostream& os, const Bag<T> &b){
os << "{ ";
Bag<T>::Node* curr=b.head;
while (curr){
//...
}
os << " }";
return os;
}


I don't get it. I declared the variable 'curr' (a pointer for iterating the list's nodes) right there.

You probably should first resolve your warnings. It's been a while since I worked with templates and friends, and they certainly are a bit tricky to deal with. This link might help you though, the example implements an
friend std::ostream& operator<< (std::ostream& o, const Foo<T>& x);

(it basically boils down to what Amnesty posted, but there is a bit of an explanation provided as well)

With templates it is not rare that the actual error is reported as a warning.


Thanks, I look into that link. I'm not sure what Amnesty meant though..

edit:
The more primitive solution worked, where I put the definition of the operator inside the class declaration.
The other "solution" generated errors.
And all is illuminated.
gedatsu
Profile Joined December 2011
1286 Posts
October 19 2013 16:03 GMT
#7507
On October 20 2013 00:04 EscPlan9 wrote:
Show nested quote +
On October 19 2013 15:55 wherebugsgo wrote:
You're given an array of numbers such that every element in the array is duplicated except for one. Provide an efficient algorithm to determine the singleton element.


I probably would have given the hash table answer. Though I'm not sure if my implementation was the same as what you were describing:


var arr = [1,1,2,2,3,3,4];
var hash = {};

// build hash - give the value 1 when initially found, and add 1 for each duplicate
for (var i = 0; i < arr.length; i++) {
if (hash[ arr[i] ] {
hash[ arr[i] ] = 1 + hash[ arr[i] ];
} else {
hash[ arr[i] ] = 1;
}
}

// iterate through hash until found a key with a value of 1 indicating no duplicates
for (var k in hash) {
if (hash[k] === 1) {
print "Unique element found: " + k;
}
}


What would be pseudocode for your implementation you mentioned with keeping track of a separate sum variable? I just used the value of the hash-key as the "sum".

Suppose arr = [2000000000,2000000000,1]
Your hash vector will get really long.
sundersoft
Profile Joined November 2011
91 Posts
October 19 2013 17:04 GMT
#7508
On October 20 2013 00:14 freelander wrote:
please help with c++ (templates + friends).
I'm getting the following error:


In addition to changing the friend statement, change

Bag<T>::Node* curr=b.head;


to


typename Bag<T>::Node* curr=b.head;


Any time you have an expression of the form "a<T>::b" where b is a type and T is a template argument of the class/function where the expression appears, you have to put "typename" before the expression.

The reason is because the compiler has to know whether 'b' is type or a variable in order to unambiguously parse your code. Depending on the definition of 'a' and what T is, 'b' could be either a type or a varible. The compiler will assume that 'a' is a variable, and you have to explicitly tell it that 'a' is a type.

Also, if you have a nested template class inside of a template class, you have to use the "template" keyword. For example, if you had a variable declaration of the form "a<T>::b<T> v;" where T is a template argument of the enclosing function or class and a and b are classes, then you would have to write it as "typename a<T>::template b<T> v;". So, you have to tell the compiler that a<T>::b is a template and you also have to tell it that a<T>::b is a class.

This only applies when T is a template argument of the code you're writing (i.e. the compiler doesn't know what T is when it's compiling your template definition). You can write an expression of the form "a<c>::b" without using the typename keyword if a and c are not template arguments for the enclosing function or class. If the compiler knowns what a and c are then it can decide if b is a type or a variable by itself.
phar
Profile Joined August 2011
United States1080 Posts
Last Edited: 2013-10-19 17:39:54
October 19 2013 17:07 GMT
#7509
On October 20 2013 01:03 gedatsu wrote:
Show nested quote +
On October 20 2013 00:04 EscPlan9 wrote:
On October 19 2013 15:55 wherebugsgo wrote:
You're given an array of numbers such that every element in the array is duplicated except for one. Provide an efficient algorithm to determine the singleton element.


I probably would have given the hash table answer. Though I'm not sure if my implementation was the same as what you were describing:


var arr = [1,1,2,2,3,3,4];
var hash = {};

// build hash - give the value 1 when initially found, and add 1 for each duplicate
for (var i = 0; i < arr.length; i++) {
if (hash[ arr[i] ] {
hash[ arr[i] ] = 1 + hash[ arr[i] ];
} else {
hash[ arr[i] ] = 1;
}
}

// iterate through hash until found a key with a value of 1 indicating no duplicates
for (var k in hash) {
if (hash[k] === 1) {
print "Unique element found: " + k;
}
}


What would be pseudocode for your implementation you mentioned with keeping track of a separate sum variable? I just used the value of the hash-key as the "sum".

Suppose arr = [2000000000,2000000000,1]
Your hash vector will get really long.

(editing for brevity & clarity)

Not only that, but the function will fail due to hash collisions (after you solve the problem in the quote). So two open things to solve:

1) What if input is larger than memory
1a) (make a better hash function)
1b) (what if input really doesn't even fit in memory - a 1TB array)
2) What if two numbers hash to the same hash value


1a) you have to solve first.
2) you have to solve second

1b) you only need to solve if the assignment explicitly calls for it - likely you don't have to

You may want to read up on actual hash functions to use, instead of just using the identity function. Find a good one to use - it's generally a horrible idea to implement your own hash function. Very close to the top of the list of "things that programmers should never implement by themselves" is hash functions, below maybe only basic algorithms and crypto, lol.
Who after all is today speaking about the destruction of the Armenians?
freelander
Profile Blog Joined December 2004
Hungary4707 Posts
Last Edited: 2013-10-19 17:19:17
October 19 2013 17:18 GMT
#7510
On October 20 2013 02:04 sundersoft wrote:
Show nested quote +
On October 20 2013 00:14 freelander wrote:
please help with c++ (templates + friends).
I'm getting the following error:


In addition to changing the friend statement, change
Show nested quote +

Bag<T>::Node* curr=b.head;


to

Show nested quote +

typename Bag<T>::Node* curr=b.head;


Any time you have an expression of the form "a<T>::b" where b is a type and T is a template argument of the class/function where the expression appears, you have to put "typename" before the expression.

The reason is because the compiler has to know whether 'b' is type or a variable in order to unambiguously parse your code. Depending on the definition of 'a' and what T is, 'b' could be either a type or a varible. The compiler will assume that 'a' is a variable, and you have to explicitly tell it that 'a' is a type.

Also, if you have a nested template class inside of a template class, you have to use the "template" keyword. For example, if you had a variable declaration of the form "a<T>::b<T> v;" where T is a template argument of the enclosing function or class and a and b are classes, then you would have to write it as "typename a<T>::template b<T> v;". So, you have to tell the compiler that a<T>::b is a template and you also have to tell it that a<T>::b is a class.

This only applies when T is a template argument of the code you're writing (i.e. the compiler doesn't know what T is when it's compiling your template definition). You can write an expression of the form "a<c>::b" without using the typename keyword if a and c are not template arguments for the enclosing function or class. If the compiler knowns what a and c are then it can decide if b is a type or a variable by itself.


thanks, that makes a lot of sense. actually it works now!
And all is illuminated.
gedatsu
Profile Joined December 2011
1286 Posts
October 19 2013 17:38 GMT
#7511
On October 20 2013 02:07 phar wrote:
Show nested quote +
On October 20 2013 01:03 gedatsu wrote:
On October 20 2013 00:04 EscPlan9 wrote:
On October 19 2013 15:55 wherebugsgo wrote:
You're given an array of numbers such that every element in the array is duplicated except for one. Provide an efficient algorithm to determine the singleton element.


I probably would have given the hash table answer. Though I'm not sure if my implementation was the same as what you were describing:


var arr = [1,1,2,2,3,3,4];
var hash = {};

// build hash - give the value 1 when initially found, and add 1 for each duplicate
for (var i = 0; i < arr.length; i++) {
if (hash[ arr[i] ] {
hash[ arr[i] ] = 1 + hash[ arr[i] ];
} else {
hash[ arr[i] ] = 1;
}
}

// iterate through hash until found a key with a value of 1 indicating no duplicates
for (var k in hash) {
if (hash[k] === 1) {
print "Unique element found: " + k;
}
}


What would be pseudocode for your implementation you mentioned with keeping track of a separate sum variable? I just used the value of the hash-key as the "sum".

Suppose arr = [2000000000,2000000000,1]
Your hash vector will get really long.

Not only that, but the function will fail due to hash collisions. So two open things to solve:

1) What if input is larger than memory
2) What if two numbers hash to the same hash value

He can't get hash collisions as he is using the value itself as its hash. But yeah, with a more sane hash function you can get collisions. Use the built-in hash table here.
obesechicken13
Profile Blog Joined July 2008
United States10467 Posts
October 19 2013 18:54 GMT
#7512
On October 19 2013 20:07 wherebugsgo wrote:
Show nested quote +
On October 19 2013 16:33 spinesheath wrote:
On October 19 2013 15:55 wherebugsgo wrote:
You're given an array of numbers such that every element in the array is duplicated except for one. Provide an efficient algorithm to determine the singleton element.

Is that the exact wording of the question? Does "duplicated" mean that the duplicate and the original are in unrelated slots of the array, or are they adjacent? Can there be multiple sets of duplicates of the same number, as in 2, 4, 6 of the number? What range are the numbers from?

Then there also is the question how one defines efficient. It's an inefficient use of programmer time if you don't just use some stupid algorithm that works and is easy to read and understand. Unless that piece of code is a performance bottleneck that needs to be faster. But I'm going to assume that low execution time is the goal here anyways.


I paraphrased, but basically you can expect to encounter two of every element in the array except for one element. The array is unsorted and the duplicates can appear anywhere. There won't be multiple (read: more than 2) instances of the same number, though the answer would remain the same for even-number duplicates-i.e. you could have 4 of the same number and 2 of another and 6 of another and finding the singleton still works the same.

There is no specification on the range of the numbers, though you can assume that you won't need multiple data structures to represent a single number. i.e. if it makes it easier for you, assume they are 32 bit ints or whatever.

My first solution required O(nlogn) time, and O(1) space. I pretty quickly realized that the time complexity can be improved to O(n) time and there's a relatively simple way of doing that by adding a data structure that takes O(n) space, but the "brilliant" answer (as the interviewer described it-I'd call it elegant) requires no additional space and is also O(n) time.

+ Show Spoiler [my shitty answer] +
Sort the array, then step through the array until you find that two consecutive elements are not the same. Sorting takes O(nlogn) time and stepping through the array takes O(n) time; O(nlogn + n) is in O(nlogn).

You could use radix sort and get an O(n) sort, I suppose.


+ Show Spoiler [an approximately equally shitty answer] +
Instead of sorting the array, maintain a hash table and a second sum variable. Iterate through the array and for each integer, check if it's in the hash table. If it isn't, then add it to the sum, and store it. If it is, then subtract it from the sum. When we've gone through the entire array, the singleton is the only element we never subtracted, thus the sum variable is the singleton.

This works in O(n) time since hash accesses are O(1), and we need O(n) space for the hash table.


the model answer
Just iterate through the array and XOR everything together. A[0] XOR A[1] XOR .... XOR A[n]. The result of this computation is the singleton element.

This works since XOR is commutative and associative. a XOR a is just 0, and 0 XOR a is a. Since all of the elements are duplicated except one of them, all the duplicates will XOR out to 0 and then the singleton will be left at the end.

This holds true also for arrays in which you have even multiples of elements, not just duplicates, though it fails when there are odd multiples.


If you guys like this sort of stuff or need interview practice, here's a few more interesting problems I encountered at career fairs/interviews and company visit sessions:

1. This problem is similar to the one I posed before, but it has a pretty major twist.

The problem statement is to find the missing integer in the array with the following rules:

a. An array A contains every integer from 0 to N except for one of them.
b. The elements of the array A may appear in any order.
c. We can't actually access an entire element of the array all at once. In other words if you index the array you won't get back the whole element. + Show Spoiler +
in other words, normally if you access an array element at index i, you would call A[i] and you would be returned the element at the ith position in A. In this problem you can't do that.
Instead, what you can do is ask for the jth bit of the ith element of the array. In other words, I could ask for the 4th bit of the first element of A, and I would be returned the bit in the 4th position of the element ordinarily given by A[0].
d. The algorithm must return the missing integer by looking through at most O(N) bits.




2. Give an approach (or code) to writing an equivalent of the C function atoi. + Show Spoiler +
I've also been asked how to implement strlen
If you're not a C programmer, atoi is a function that converts an ASCII string to an integer. Describe the limitations or shortcomings of your approch (or code) in as much detail as you can.




3. Suppose we have a function that computes rand2() (i.e. a fair coin toss-it outputs 1 or 2 with equal probability). Design an algorithm that uses this function to simulate a fair die roll, i.e. a function that should output a random number from 1 to 6 with equal probability.


How does this work? What are you XORing together?

Are you XORing 0 with every element or the previous element with the next element or what?
Diagrams would be helpful.

Also it still seems like you're doing this in O(n) time and I liked your previous solutions better since they were more intuitive. I don't think of using XOR when I want to solve a problem like this. That's something you learn to see in (?) programming competitions.

The only advantage I see with XOR over radix sort is that if you have really large integers then Radix sort would be slow.
I think in our modern age technology has evolved to become more addictive. The things that don't give us pleasure aren't used as much. Work was never meant to be fun, but doing it makes us happier in the long run.
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
Last Edited: 2013-10-19 19:27:13
October 19 2013 19:26 GMT
#7513
On October 20 2013 03:54 obesechicken13 wrote:
How does this work? What are you XORing together?

Are you XORing 0 with every element or the previous element with the next element or what?
Diagrams would be helpful.

Also it still seems like you're doing this in O(n) time and I liked your previous solutions better since they were more intuitive. I don't think of using XOR when I want to solve a problem like this. That's something you learn to see in (?) programming competitions.

The only advantage I see with XOR over radix sort is that if you have really large integers then Radix sort would be slow.

What he does is
cur = 0;
foreach(n in array)
cur = cur XOR n;
return cur;


Does radix sort work in situ? And even if it does, you might not be allowed to modify the array. So XOR has the memory advantage.

I personally was thinking of alternating sums as in Sum a[i] * (-1)^i, which would work in the case of adjacent duplicates. XOR is pretty much the same concept.
If you have a good reason to disagree with the above, please tell me. Thank you.
phar
Profile Joined August 2011
United States1080 Posts
October 19 2013 19:33 GMT
#7514
On October 20 2013 02:38 gedatsu wrote:
Show nested quote +
On October 20 2013 02:07 phar wrote:
On October 20 2013 01:03 gedatsu wrote:
On October 20 2013 00:04 EscPlan9 wrote:
On October 19 2013 15:55 wherebugsgo wrote:
You're given an array of numbers such that every element in the array is duplicated except for one. Provide an efficient algorithm to determine the singleton element.


I probably would have given the hash table answer. Though I'm not sure if my implementation was the same as what you were describing:


var arr = [1,1,2,2,3,3,4];
var hash = {};

// build hash - give the value 1 when initially found, and add 1 for each duplicate
for (var i = 0; i < arr.length; i++) {
if (hash[ arr[i] ] {
hash[ arr[i] ] = 1 + hash[ arr[i] ];
} else {
hash[ arr[i] ] = 1;
}
}

// iterate through hash until found a key with a value of 1 indicating no duplicates
for (var k in hash) {
if (hash[k] === 1) {
print "Unique element found: " + k;
}
}


What would be pseudocode for your implementation you mentioned with keeping track of a separate sum variable? I just used the value of the hash-key as the "sum".

Suppose arr = [2000000000,2000000000,1]
Your hash vector will get really long.

Not only that, but the function will fail due to hash collisions. So two open things to solve:

1) What if input is larger than memory
2) What if two numbers hash to the same hash value

He can't get hash collisions as he is using the value itself as its hash. But yeah, with a more sane hash function you can get collisions. Use the built-in hash table here.

Yea sorry I was getting a step ahead of himself. I meant that after he solves the problem you pointed out (identity hash function), he will then have to solve the problem of hash collisions.
Who after all is today speaking about the destruction of the Armenians?
spinesheath
Profile Blog Joined June 2009
Germany8679 Posts
October 19 2013 19:58 GMT
#7515
On October 20 2013 04:33 phar wrote:
Show nested quote +
On October 20 2013 02:38 gedatsu wrote:
On October 20 2013 02:07 phar wrote:
On October 20 2013 01:03 gedatsu wrote:
On October 20 2013 00:04 EscPlan9 wrote:
On October 19 2013 15:55 wherebugsgo wrote:
You're given an array of numbers such that every element in the array is duplicated except for one. Provide an efficient algorithm to determine the singleton element.


I probably would have given the hash table answer. Though I'm not sure if my implementation was the same as what you were describing:


var arr = [1,1,2,2,3,3,4];
var hash = {};

// build hash - give the value 1 when initially found, and add 1 for each duplicate
for (var i = 0; i < arr.length; i++) {
if (hash[ arr[i] ] {
hash[ arr[i] ] = 1 + hash[ arr[i] ];
} else {
hash[ arr[i] ] = 1;
}
}

// iterate through hash until found a key with a value of 1 indicating no duplicates
for (var k in hash) {
if (hash[k] === 1) {
print "Unique element found: " + k;
}
}


What would be pseudocode for your implementation you mentioned with keeping track of a separate sum variable? I just used the value of the hash-key as the "sum".

Suppose arr = [2000000000,2000000000,1]
Your hash vector will get really long.

Not only that, but the function will fail due to hash collisions. So two open things to solve:

1) What if input is larger than memory
2) What if two numbers hash to the same hash value

He can't get hash collisions as he is using the value itself as its hash. But yeah, with a more sane hash function you can get collisions. Use the built-in hash table here.

Yea sorry I was getting a step ahead of himself. I meant that after he solves the problem you pointed out (identity hash function), he will then have to solve the problem of hash collisions.

The idea is to not try to implement the hashtable yourself, but to just use an existing one instead. Those come with built in strategies for collisions.
If you have a good reason to disagree with the above, please tell me. Thank you.
opsayo
Profile Blog Joined July 2008
591 Posts
Last Edited: 2013-10-19 23:38:25
October 19 2013 23:37 GMT
#7516
if (mHashTable.containsKey(array[i]))
mHashTable.remove(array[i]));
else
mHashTable.put(array[i], 1);
uniqueElement = mHashTable.keys().nextElement();

O(n) time O(n/2) space
Cyx.
Profile Joined November 2010
Canada806 Posts
October 20 2013 00:05 GMT
#7517
On October 20 2013 03:54 obesechicken13 wrote:
How does this work? What are you XORing together?

Are you XORing 0 with every element or the previous element with the next element or what?
Diagrams would be helpful.

Also it still seems like you're doing this in O(n) time and I liked your previous solutions better since they were more intuitive. I don't think of using XOR when I want to solve a problem like this. That's something you learn to see in (?) programming competitions.

The only advantage I see with XOR over radix sort is that if you have really large integers then Radix sort would be slow.


Even if it's technically constant time it's still a lot faster probably since bitwise operations are so quick ^^ also it takes up no memory which is a bonus. In terms of efficiency it doesn't get much better than XORing a bunch of things together.
EscPlan9
Profile Blog Joined December 2006
United States2777 Posts
October 20 2013 00:18 GMT
#7518
On October 20 2013 04:58 spinesheath wrote:
Show nested quote +
On October 20 2013 04:33 phar wrote:
On October 20 2013 02:38 gedatsu wrote:
On October 20 2013 02:07 phar wrote:
On October 20 2013 01:03 gedatsu wrote:
On October 20 2013 00:04 EscPlan9 wrote:
On October 19 2013 15:55 wherebugsgo wrote:
You're given an array of numbers such that every element in the array is duplicated except for one. Provide an efficient algorithm to determine the singleton element.


I probably would have given the hash table answer. Though I'm not sure if my implementation was the same as what you were describing:


var arr = [1,1,2,2,3,3,4];
var hash = {};

// build hash - give the value 1 when initially found, and add 1 for each duplicate
for (var i = 0; i < arr.length; i++) {
if (hash[ arr[i] ] {
hash[ arr[i] ] = 1 + hash[ arr[i] ];
} else {
hash[ arr[i] ] = 1;
}
}

// iterate through hash until found a key with a value of 1 indicating no duplicates
for (var k in hash) {
if (hash[k] === 1) {
print "Unique element found: " + k;
}
}


What would be pseudocode for your implementation you mentioned with keeping track of a separate sum variable? I just used the value of the hash-key as the "sum".

Suppose arr = [2000000000,2000000000,1]
Your hash vector will get really long.

Not only that, but the function will fail due to hash collisions. So two open things to solve:

1) What if input is larger than memory
2) What if two numbers hash to the same hash value

He can't get hash collisions as he is using the value itself as its hash. But yeah, with a more sane hash function you can get collisions. Use the built-in hash table here.

Yea sorry I was getting a step ahead of himself. I meant that after he solves the problem you pointed out (identity hash function), he will then have to solve the problem of hash collisions.

The idea is to not try to implement the hashtable yourself, but to just use an existing one instead. Those come with built in strategies for collisions.


I'm very confused by the responses here. I wasn't implementing a hash table myself. I was using built-in hash structures found in most languages, in the code above it was Javascript. If a key is found, you can detect it and handle it however you want - in this case all I do is change the value because I found another instance of the element. If a key is not found, one is created. Pretty simple...

As to "what if two numbers hash to the same hash value"? How does that even matter. Like if you run the code above, you'll find out the Keys '1', '2', and '3' all have a value of 2, and the Key '4' has a value of 1. The crux of the problem was to find non-duplicate elements in an array. So all non-duplicate elements would have a value of 1... and that's it. It doesn't matter if they hash to the same value - as long as the value is 1 in my solution, then we found a unique element in the array.
Undefeated TL Tecmo Super Bowl League Champion
phar
Profile Joined August 2011
United States1080 Posts
October 20 2013 02:57 GMT
#7519
On October 20 2013 09:18 EscPlan9 wrote:
Show nested quote +
On October 20 2013 04:58 spinesheath wrote:
On October 20 2013 04:33 phar wrote:
On October 20 2013 02:38 gedatsu wrote:
On October 20 2013 02:07 phar wrote:
On October 20 2013 01:03 gedatsu wrote:
On October 20 2013 00:04 EscPlan9 wrote:
On October 19 2013 15:55 wherebugsgo wrote:
You're given an array of numbers such that every element in the array is duplicated except for one. Provide an efficient algorithm to determine the singleton element.


I probably would have given the hash table answer. Though I'm not sure if my implementation was the same as what you were describing:


var arr = [1,1,2,2,3,3,4];
var hash = {};

// build hash - give the value 1 when initially found, and add 1 for each duplicate
for (var i = 0; i < arr.length; i++) {
if (hash[ arr[i] ] {
hash[ arr[i] ] = 1 + hash[ arr[i] ];
} else {
hash[ arr[i] ] = 1;
}
}

// iterate through hash until found a key with a value of 1 indicating no duplicates
for (var k in hash) {
if (hash[k] === 1) {
print "Unique element found: " + k;
}
}


What would be pseudocode for your implementation you mentioned with keeping track of a separate sum variable? I just used the value of the hash-key as the "sum".

Suppose arr = [2000000000,2000000000,1]
Your hash vector will get really long.

Not only that, but the function will fail due to hash collisions. So two open things to solve:

1) What if input is larger than memory
2) What if two numbers hash to the same hash value

He can't get hash collisions as he is using the value itself as its hash. But yeah, with a more sane hash function you can get collisions. Use the built-in hash table here.

Yea sorry I was getting a step ahead of himself. I meant that after he solves the problem you pointed out (identity hash function), he will then have to solve the problem of hash collisions.

The idea is to not try to implement the hashtable yourself, but to just use an existing one instead. Those come with built in strategies for collisions.


I'm very confused by the responses here. I wasn't implementing a hash table myself. I was using built-in hash structures found in most languages, in the code above it was Javascript. If a key is found, you can detect it and handle it however you want - in this case all I do is change the value because I found another instance of the element. If a key is not found, one is created. Pretty simple...

As to "what if two numbers hash to the same hash value"? How does that even matter. Like if you run the code above, you'll find out the Keys '1', '2', and '3' all have a value of 2, and the Key '4' has a value of 1. The crux of the problem was to find non-duplicate elements in an array. So all non-duplicate elements would have a value of 1... and that's it. It doesn't matter if they hash to the same value - as long as the value is 1 in my solution, then we found a unique element in the array.

You are correct that if you use the identity function has your hash, you will never have a collision. Your code completely fails for large input, because you'll run out of memory and die.

Since you didn't really give us much background information we just have to guess as to what your requirements are.

If your requirements are like

1) Input array will never be >10k/100k ish items

Then sure, use identity as your hash and be done with it.


If you're confused just in general about what a hash table is, I suggest you pick up a data structures textbook (or find some resources online). It's one of the most useful data structures in programming.
Who after all is today speaking about the destruction of the Armenians?
obesechicken13
Profile Blog Joined July 2008
United States10467 Posts
October 20 2013 03:07 GMT
#7520
On October 20 2013 09:05 Cyx. wrote:
Show nested quote +
On October 20 2013 03:54 obesechicken13 wrote:
How does this work? What are you XORing together?

Are you XORing 0 with every element or the previous element with the next element or what?
Diagrams would be helpful.

Also it still seems like you're doing this in O(n) time and I liked your previous solutions better since they were more intuitive. I don't think of using XOR when I want to solve a problem like this. That's something you learn to see in (?) programming competitions.

The only advantage I see with XOR over radix sort is that if you have really large integers then Radix sort would be slow.


Even if it's technically constant time it's still a lot faster probably since bitwise operations are so quick ^^ also it takes up no memory which is a bonus. In terms of efficiency it doesn't get much better than XORing a bunch of things together.

I guess this is true.

Still, the solution is not something I'd understand if I just saw the code with little. When you think of duplicate problems, or you gave a 4th gradera piece of paper with a bunch of numbers on them, they'd solve it using sorting algorithms (in their head). I still remember sorting stuff in elementary math to get modes.
I think in our modern age technology has evolved to become more addictive. The things that don't give us pleasure aren't used as much. Work was never meant to be fun, but doing it makes us happier in the long run.
Prev 1 374 375 376 377 378 1032 Next
Please log in or register to reply.
Live Events Refresh
IPSL
16:00
Ro24 Group D
JDConan vs TBD
Aegong vs rasowy
Liquipedia
PSISTORM Gaming Misc
15:55
FSL s10 code S playoffs
Freeedom40
Liquipedia
Ladder Legends
15:00
Valedictorian Cup #1 Qualifier
SteadfastSC236
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Liquid`TLO 461
SteadfastSC 236
elazer 102
BRAT_OK 64
JuggernautJason14
StarCraft: Brood War
Calm 3327
Mini 501
firebathero 146
Dewaltoss 99
actioN 79
Killer 36
yabsab 29
Rock 28
Movie 25
GoRush 12
[ Show more ]
Hm[arnc] 10
Dota 2
Gorgc6309
Counter-Strike
fl0m9939
olofmeister2650
byalli595
Super Smash Bros
Mew2King132
Heroes of the Storm
Khaldor697
Liquid`Hasu506
Other Games
Grubby4627
FrodaN993
B2W.Neo690
KnowMe234
RotterdaM72
MindelVK16
Organizations
Dota 2
PGL Dota 2 - Secondary Stream3234
StarCraft 2
ComeBackTV 842
Other Games
BasetradeTV828
gamesdonequick807
StarCraft 2
angryscii 37
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 24 non-featured ]
StarCraft 2
• Shameless 30
• LUISG 23
• Adnapsc2 15
• Reevou 7
• maralekos5
• Response 3
• OhrlRock 1
• Migwel
• LaughNgamezSOOP
• IndyKCrew
• Kozan
• AfreecaTV YouTube
• sooper7s
• intothetv
StarCraft: Brood War
• Airneanach78
• 80smullet 9
• FirePhoenix6
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
League of Legends
• TFBlade1689
• Nemesis1562
Other Games
• imaqtpie837
• Shiphtur199
Upcoming Events
BSL
32m
StRyKeR vs rasowy
Artosis vs Aether
JDConan vs OyAji
Hawk vs izu
Replay Cast
5h 32m
Replay Cast
14h 32m
Wardi Open
15h 32m
Afreeca Starleague
15h 32m
Bisu vs Ample
Jaedong vs Flash
Monday Night Weeklies
21h 32m
RSL Revival
1d 7h
GSL
1d 13h
Afreeca Starleague
1d 15h
Barracks vs Leta
Royal vs Light
WardiTV Map Contest Tou…
1d 16h
[ Show More ]
RSL Revival
2 days
Replay Cast
3 days
The PondCast
3 days
KCM Race Survival
3 days
WardiTV Map Contest Tou…
3 days
CranKy Ducklings
4 days
Escore
4 days
RSL Revival
4 days
WardiTV Map Contest Tou…
5 days
Universe Titan Cup
5 days
Rogue vs Percival
Ladder Legends
5 days
uThermal 2v2 Circuit
5 days
BSL
6 days
Sparkling Tuna Cup
6 days
WardiTV Map Contest Tou…
6 days
Ladder Legends
6 days
Liquipedia Results

Completed

Escore Tournament S2: W3
RSL Revival: Season 4
NationLESS Cup

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
StarCraft2 Community Team League 2026 Spring
WardiTV TLMC #16
Nations Cup 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026

Upcoming

Escore Tournament S2: W4
Acropolis #4
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
2026 GSL S2
RSL Revival: Season 5
2026 GSL S1
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
IEM Atlanta 2026
Asian Champions League 2026
PGL Astana 2026
BLAST Rivals Spring 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.