• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 07:05
CET 13:05
KST 21:05
  • 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
RSL Revival - 2025 Season Finals Preview8RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12
Community News
Weekly Cups (Dec 29-Jan 4): Protoss rolls, 2v2 returns0[BSL21] Non-Korean Championship - Starts Jan 103SC2 All-Star Invitational: Jan 17-1822Weekly Cups (Dec 22-28): Classic & MaxPax win, Percival surprises3Weekly Cups (Dec 15-21): Classic wins big, MaxPax & Clem take weeklies3
StarCraft 2
General
Weekly Cups (Dec 29-Jan 4): Protoss rolls, 2v2 returns SC2 All-Star Invitational: Jan 17-18 Weekly Cups (Dec 22-28): Classic & MaxPax win, Percival surprises Chinese SC2 server to reopen; live all-star event in Hangzhou Starcraft 2 Zerg Coach
Tourneys
uThermal 2v2 Circuit OSC Season 13 World Championship WardiTV Mondays $5,000+ WardiTV 2025 Championship $100 Prize Pool - Winter Warp Gate Masters Showdow
Strategy
https://www.facebook.com/EMSenseMassagerAustralia Simple Questions Simple Answers
Custom Maps
Map Editor closed ?
External Content
Mutation # 507 Well Trained Mutation # 506 Warp Zone Mutation # 505 Rise From Ashes Mutation # 504 Retribution
Brood War
General
Data analysis on 70 million replays I would like to say something about StarCraft BGH Auto Balance -> http://bghmmr.eu/ Empty tournaments section on Liquipedia A cwal.gg Extension - Easily keep track of anyone
Tourneys
[BSL21] Grand Finals - Sunday 21:00 CET [BSL21] Non-Korean Championship - Starts Jan 10 [Megathread] Daily Proleagues SLON Grand Finals – Season 2
Strategy
Game Theory for Starcraft Current Meta Simple Questions, Simple Answers [G] How to get started on ladder as a new Z player
Other Games
General Games
Nintendo Switch Thread Should offensive tower rushing be viable in RTS games? Awesome Games Done Quick 2026! General RTS Discussion Thread Beyond All Reason
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
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 Survivor II: The Amazon Sengoku Mafia
Community
General
US Politics Mega-thread Trading/Investing Thread Russo-Ukrainian War Thread The Big Programming Thread Canadian Politics Mega-thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece
Sports
2024 - 2026 Football Thread Formula 1 Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List TL+ Announced
Blogs
Psychological Factors That D…
TrAiDoS
James Bond movies ranking - pa…
Topin
StarCraft improvement
iopq
GOAT of Goats list
BisuDagger
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1115 users

An interesting complex programming problem - Page 2

Blogs > Qzy
Post a Reply
Prev 1 2 All
Qzy
Profile Blog Joined July 2010
Denmark1121 Posts
May 21 2011 19:57 GMT
#21
Sounds good I'm trying to work out something aswell.
TG Sambo... Intel classic! Life of lively to live to life of full life thx to shield battery
evanthebouncy
Profile Joined November 2004
China491 Posts
Last Edited: 2011-05-21 20:37:22
May 21 2011 20:35 GMT
#22
can I have some bearing on this problem? Are you saying your initial set, i.e. the set that's a subset of
{ {0,1,#}^n } is relatively large or small?

by big I mean is it close to the size 3^n i.e. everything?
BOINK BOINK! Recursively defined
Qzy
Profile Blog Joined July 2010
Denmark1121 Posts
May 21 2011 20:41 GMT
#23
It's huuge, as in 1 million strings.
TG Sambo... Intel classic! Life of lively to live to life of full life thx to shield battery
Oracle
Profile Blog Joined May 2007
Canada411 Posts
May 21 2011 20:47 GMT
#24
I think evan is more asking how many permutations are covered than how many strings there are in total.

Because 1 million strings is meaningless without the size of n (length of a string)
Qzy
Profile Blog Joined July 2010
Denmark1121 Posts
May 21 2011 20:52 GMT
#25
All strings are different from eachother :O.
TG Sambo... Intel classic! Life of lively to live to life of full life thx to shield battery
evanthebouncy
Profile Joined November 2004
China491 Posts
May 21 2011 20:56 GMT
#26
What oracle said.

I'll say my idea now as I'll be going to my old apartment trying to contact a moving company to move some stuff. But my idea so far is this:

Create a DAG on the initial string structure, with the vertex in the DAG the strings themselves, and the edge correspond to an "implication".

The edge is defined as this:
vertex v implies vertex u if we accept v implies we have to accept u as well.

To make it concrete, vertex (0#1) will have an edge pointing to vertex (0##) because if we accept the string 0#1 we MUST accept the string 0##.

So, suppose you CAN construct this DAG (i'm working on how to best construct it, you don't want the dag to be dense, for instance), the lookup will be something like this:

on input message:

ret = {}
while DAG not empty:
...for all leaf-nodes in DAG: #i.e. the nodes who have no implication pointing toward them
......if satisify(leaf-node, message): #if we accept the leaf node as matching the msg
.........move( transitiveClosure(leaf-node), ret) #take the leaf node, and all it implies, to the return set
......else: #if the leaf do not satisfy
.........delete(leaf-node) #remove the leaf node, so some other node can potentially be new leaf node

I don't have bound on the runtime of lookup, however, if you look at it I'm gaining knowledge as I traverse through the graph, which is good. When I decide if I want to match a particular string to my message, not only I learned if I can match it, but I also learned if other things can match it.

So yeah, gtg now, will think it through on paper, brb!!
BOINK BOINK! Recursively defined
evanthebouncy
Profile Joined November 2004
China491 Posts
May 21 2011 20:58 GMT
#27
On May 22 2011 05:52 Qzy wrote:
All strings are different from eachother :O.

no no that doesn't tell me anything.

Say you have the set {0,1,#}^3, so that's 27 total strings right?
How dense is your data set? is it just {001, #11, 01#} i.e. only 1/9 of the total string?
or is it super dense like, 20 of the total string?
BOINK BOINK! Recursively defined
Oracle
Profile Blog Joined May 2007
Canada411 Posts
May 21 2011 21:05 GMT
#28
On May 22 2011 05:56 evanthebouncy wrote:
What oracle said.

I'll say my idea now as I'll be going to my old apartment trying to contact a moving company to move some stuff. But my idea so far is this:

Create a DAG on the initial string structure, with the vertex in the DAG the strings themselves, and the edge correspond to an "implication".

The edge is defined as this:
vertex v implies vertex u if we accept v implies we have to accept u as well.

To make it concrete, vertex (0#1) will have an edge pointing to vertex (0##) because if we accept the string 0#1 we MUST accept the string 0##.

So, suppose you CAN construct this DAG (i'm working on how to best construct it, you don't want the dag to be dense, for instance), the lookup will be something like this:

on input message:

ret = {}
while DAG not empty:
...for all leaf-nodes in DAG: #i.e. the nodes who have no implication pointing toward them
......if satisify(leaf-node, message): #if we accept the leaf node as matching the msg
.........move( transitiveClosure(leaf-node), ret) #take the leaf node, and all it implies, to the return set
......else: #if the leaf do not satisfy
.........delete(leaf-node) #remove the leaf node, so some other node can potentially be new leaf node

I don't have bound on the runtime of lookup, however, if you look at it I'm gaining knowledge as I traverse through the graph, which is good. When I decide if I want to match a particular string to my message, not only I learned if I can match it, but I also learned if other things can match it.

So yeah, gtg now, will think it through on paper, brb!!

I played around with the idea of a DAG for a bit but I couldn't find a good way to construct it, do post if you figure out an efficient way.

In fact the lookup time will be very short, its just the construction which is the basis of your algorithm which may make or break it.
Qzy
Profile Blog Joined July 2010
Denmark1121 Posts
May 21 2011 21:13 GMT
#29
On May 22 2011 05:58 evanthebouncy wrote:
Show nested quote +
On May 22 2011 05:52 Qzy wrote:
All strings are different from eachother :O.

no no that doesn't tell me anything.

Say you have the set {0,1,#}^3, so that's 27 total strings right?
How dense is your data set? is it just {001, #11, 01#} i.e. only 1/9 of the total string?
or is it super dense like, 20 of the total string?


I'm a bit confused by this comment (sorry, mate, i know you are trying to help )

The string can be set to any length to begin with, consisting of only 1, 0 and #.
The amount of wildcards can be set aswell, ie 40% chance of wilcard being inserted.

In the end you end up with some random string:
10101010
0111110#
00#1011#, etc. There can be millions of these

Then a message is given: (no wildcards, same length of the strings) 10101111, and you have to find all the strings which satisfies the message, given wildcards can represent both 1 and 0.
TG Sambo... Intel classic! Life of lively to live to life of full life thx to shield battery
Qzy
Profile Blog Joined July 2010
Denmark1121 Posts
May 21 2011 21:26 GMT
#30
And yes, please do post your code here for all to see seems to be lots of followers to this blog post.
TG Sambo... Intel classic! Life of lively to live to life of full life thx to shield battery
pullarius1
Profile Blog Joined May 2010
United States523 Posts
May 21 2011 21:47 GMT
#31
On May 22 2011 06:13 Qzy wrote:
Show nested quote +
On May 22 2011 05:58 evanthebouncy wrote:
On May 22 2011 05:52 Qzy wrote:
All strings are different from eachother :O.

no no that doesn't tell me anything.

Say you have the set {0,1,#}^3, so that's 27 total strings right?
How dense is your data set? is it just {001, #11, 01#} i.e. only 1/9 of the total string?
or is it super dense like, 20 of the total string?


I'm a bit confused by this comment (sorry, mate, i know you are trying to help )

The string can be set to any length to begin with, consisting of only 1, 0 and #.
The amount of wildcards can be set aswell, ie 40% chance of wilcard being inserted.

In the end you end up with some random string:
10101010
0111110#
00#1011#, etc. There can be millions of these

Then a message is given: (no wildcards, same length of the strings) 10101111, and you have to find all the strings which satisfies the message, given wildcards can represent both 1 and 0.



He's essentially asking what percentage of all possible strings exist in the 01# set? You said there are 40 bits in the strings, giving 3^40 possible strings. Do you know about what fraction of those are in the reference set? I could imagine, for instance, that if the number was high enough, the complement problem could actually be easier to solve.
@pullarius1
Qzy
Profile Blog Joined July 2010
Denmark1121 Posts
Last Edited: 2011-05-21 22:12:12
May 21 2011 22:03 GMT
#32
It's possible to set a cap on the amount of strings possible, ie 50,000 or 1 million. So when 1 million strings exists, it's no longer possible to insert more strings. We would probably crash even googles servers if we allowed 3^40, hehe.
TG Sambo... Intel classic! Life of lively to live to life of full life thx to shield battery
DeLoAdEr
Profile Blog Joined July 2003
Japan527 Posts
May 21 2011 22:28 GMT
#33
Hmm, just a quick thought: maybe it helps if you sort the strings into different sets depending on their digits.

Lets call S_{n, k} the set of your strings which have char k at digit n. For example S_{1, 1} = { 0001, 111#, 1111, 011#, ... } is the set of all your strings containing the 1 at the least-significant bit.

For a given string s the goal is now to calculate the intersection between S_{1, s[1]}, S_{2, s[2]}, ..., S_{p, s[p]}. The brute-force implementation of this intersection would have a runtime of O(n * p) again i think. =(

But this could be programmed efficiently with bitvectors representing the sets and logical AND for intersection.
evanthebouncy
Profile Joined November 2004
China491 Posts
May 22 2011 01:32 GMT
#34
On May 22 2011 06:05 Oracle wrote:
Show nested quote +
On May 22 2011 05:56 evanthebouncy wrote:
What oracle said.

I'll say my idea now as I'll be going to my old apartment trying to contact a moving company to move some stuff. But my idea so far is this:

Create a DAG on the initial string structure, with the vertex in the DAG the strings themselves, and the edge correspond to an "implication".

The edge is defined as this:
vertex v implies vertex u if we accept v implies we have to accept u as well.

To make it concrete, vertex (0#1) will have an edge pointing to vertex (0##) because if we accept the string 0#1 we MUST accept the string 0##.

So, suppose you CAN construct this DAG (i'm working on how to best construct it, you don't want the dag to be dense, for instance), the lookup will be something like this:

on input message:

ret = {}
while DAG not empty:
...for all leaf-nodes in DAG: #i.e. the nodes who have no implication pointing toward them
......if satisify(leaf-node, message): #if we accept the leaf node as matching the msg
.........move( transitiveClosure(leaf-node), ret) #take the leaf node, and all it implies, to the return set
......else: #if the leaf do not satisfy
.........delete(leaf-node) #remove the leaf node, so some other node can potentially be new leaf node

I don't have bound on the runtime of lookup, however, if you look at it I'm gaining knowledge as I traverse through the graph, which is good. When I decide if I want to match a particular string to my message, not only I learned if I can match it, but I also learned if other things can match it.

So yeah, gtg now, will think it through on paper, brb!!

I played around with the idea of a DAG for a bit but I couldn't find a good way to construct it, do post if you figure out an efficient way.

In fact the lookup time will be very short, its just the construction which is the basis of your algorithm which may make or break it.


You want to make a GOOD dag, which is tricky...

You want the dag to be "deep" rather than shallow, because the deeper it is the more inference you can do...

construction is indeed tricky.

For the sake of algorithm let us abstract the problem to a higher level...

Let there be a collection of sets: F = { A_i s.t. A_i is a set }
For example, F can be F = { {1,2,3}, {1,3}, {1}, {2,3} }

Find an efficient algorithm that given an element a, return a collection that contains all the sets inside F which contains a.
For example, take F as it is, and say we want to return all the sets containing 1. We'd return
T = { {1,2,3}, {1,3}, {1} }
Whereas if we try to say containing 2, we'd return
T = { {1,2,3}, {2,3} }

You see how these 2 problems are equivalent.

BOINK BOINK! Recursively defined
Qzy
Profile Blog Joined July 2010
Denmark1121 Posts
May 22 2011 20:24 GMT
#35
Someone actually rated this 1 star Sick..

It's a good discussion I think - reading every post carefully.
TG Sambo... Intel classic! Life of lively to live to life of full life thx to shield battery
Prev 1 2 All
Please log in or register to reply.
Live Events Refresh
Wardi Open
12:00
#68
Rex0
WardiTV0
OGKoka 0
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SortOf 235
Rex 0
OGKoka 0
StarCraft: Brood War
Sea 2912
Horang2 2839
Jaedong 1093
actioN 448
Larva 379
firebathero 372
BeSt 329
Hyuk 302
Rush 300
Shuttle 283
[ Show more ]
Light 235
ggaemo 223
Mini 160
Sharp 146
ZerO 130
Snow 124
Pusan 107
Leta 104
Killer 91
Hyun 91
Mong 82
Aegong 69
hero 67
Sea.KH 44
Bale 30
soO 30
Nal_rA 24
Soma 21
sorry 20
yabsab 20
JulyZerg 18
scan(afreeca) 13
Sacsri 10
Icarus 5
Shine 5
Terrorterran 3
Dota 2
XaKoH 736
XcaliburYe232
NeuroSwarm101
League of Legends
JimRising 504
C9.Mang0492
Counter-Strike
olofmeister1990
shoxiejesuss1044
zeus879
x6flipin545
edward127
Other Games
singsing1917
B2W.Neo1435
Pyrionflax323
crisheroes271
Gorgc63
BRAT_OK 53
MindelVK19
ZerO(Twitch)9
QueenE1
Organizations
Other Games
gamesdonequick28419
StarCraft: Brood War
UltimateBattle 335
lovetv 5
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 11 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• iopq 5
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Upcoming Events
RotterdaM Event
5h 25m
Patches Events
7h 55m
PiGosaur Cup
12h 55m
OSC
23h 55m
SOOP
1d 15h
OSC
1d 23h
OSC
3 days
SOOP
4 days
The PondCast
4 days
Sparkling Tuna Cup
5 days
[ Show More ]
IPSL
6 days
DragOn vs Sziky
Replay Cast
6 days
Wardi Open
6 days
Liquipedia Results

Completed

BSL Season 21
WardiTV 2025
META Madness #9

Ongoing

C-Race Season 1
IPSL Winter 2025-26
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025

Upcoming

Escore Tournament S1: W3
BSL 21 Non-Korean Championship
CSL 2025 WINTER (S19)
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Thunderfire SC2 All-star 2025
Big Gabe Cup #3
OSC Championship Season 13
Nations Cup 2026
Underdog Cup #3
NA Kuram Kup
BLAST Open Spring 2026
ESL Pro League Season 23
ESL Pro League Season 23
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
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.