[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

let's see how smart is /g/ >input two strings >output

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 55
Thread images: 6

File: 1477159719707.jpg (241KB, 1870x1227px) Image search: [Google]
1477159719707.jpg
241KB, 1870x1227px
let's see how smart is /g/

>input two strings
>output string with maximum number of maximum length alphabet substrings

for example:

aabb
caddbb
=
abcd abd ab b
>>
This is how coding is thought at universities, folks.

Don't be that guy. Work on practical problems instead.
>>
>>57955475
>alphabet substrings
What the fuck do you even mean like that?
I cannot see the pattern that caused those inputs to return those outputs.
>3D Image
Disgusting.
>>
>>57955504

jesus christ, you input any two strings and make mini alphabets with the letters you have
>>
>>57955475
>string with maximum number of maximum length alphabet substrings

if you want us to do your homework, just post it word-for-word. because you're not making sense pajeet.
>>
>>57955521
So you just return the set of characters that occurs in both strings?
That seems too trivial to be even slightly interesting.
>>
>>57955521
>make mini alphabets with the letters you have

wtf?

why is the second part of the output "abd" instead of "abc"? why is the last part "b" instead of "a"?
>>
>>57955536

ok eng is not my language and I just made this problem up, took me 2 mins

how can't you retards understand this kys everybody
>>
>>57955576
>how can't you retards understand this
Your explanation is fucking terrible. It's not obvious at all why that input leads to that output.
Why don't you post some code that does whatever the fuck you're talking about?
>>
>>57955475
<code> test </code>
>>
<code> test2 <\code>
>>
File: oyster.gif (1MB, 300x252px) Image search: [Google]
oyster.gif
1MB, 300x252px
>output string with maximum number of maximum length alphabet substrings
>you input any two strings and make mini alphabets with the letters you have

So basically take a bunch of strings and then pull as many A-Z alphabets out of them as you can?

I think I see what you're getting at, but sweet Christ you could've explained it a whole lot better considering you're asking /g/ to do your homework. Also, Pajeet detected. So, without further ado,

DESIGNATED
>>
>>57955603

I think he's backpedaling because he realizes there isn't any logic behind what he came up with.

output seriously makes no sense.
>>
>>57955608
>>57955618
omfg how to do?
>>
>>57955626

not homework I just made it up you faggot
>>
>>57955626
>So basically take a bunch of strings and then pull as many A-Z alphabets out of them as you can?

yes ffs
>>
>>57955552
i think what he is asking is use all of the letters to make "mini alphabets".
So, if there is
aabbcc
it would be
abc abc
>>
>>57955659
Your output still makes no fucking sense.
>>
>>57955475
>college tier problems

Real problem is you have 500 terabytes of data in mysql and you need to transfer to a nosql mongodb
>>
>>57955626
SHITTING
>>
>>57955502
This. OP doesn't actually want to make a point on the intelligence of /g/angsters but instead wants to have someone do their homework.
>>
>>57955626
>>57955809
STREETS
>>
>>57955815

>hurrr homework

I made that shit up, you fags can barely understand the problem, I give up, you can't solve this
>>
>>57955635


it's square brackets I think. not <>

>>
 will smith 
>>
>>57955979
If the task is now over, can you show the code that does the correct thing? You do have it, right?
>>
I'm thinking since your initial input string can come in any order, use a hash table with buckets (linked lists) in which the hash function is that the ascii value of the character - some constant (so that 'a' gets put at index 0). That way you have a sorted hash table with whatever number of a's, b's etc. Then from there go through the table, pulling one letter if the bucket has something or moving to the next bucket if nothing is present. When you reach the end of the table, you start over on your next string. At the end the table is empty and you have all the useless mini alphabets and you can jo to your algo skills in peace
>>
 test 3 [\code]
>>
 test 4 
>>
>>57956225
Delete your posts after you're done fucking with code brackets.
>>
>>57956195

yeah something like that, delete the bucket when empty to reduce operations
>>
>>57955475
Do your own fucking homework. That;s a typical homework-style question.
>>
>[{test{} test} \code(TEST_) } ]
>>
>>57955475
>break down string
>sort letters alphabetically

loop:
>determine number of unique characters in string
>get one character from parent string, remove it from parent and put it into a new string
>check with the unique character counter, if your string has less characters, proceed to cut another character that is not contained within your new string
>else print the new string
>repeat loop

Now be a good boy and do your homework
>>
>>57956465
>O(nlogn)
Thanks for your time. Don't call us; we'll call you.
>>
>>57955475
Prove you're not a faggot and do it in O(1) space. If you can't can't you should just drop out desu
>>
So take the letters, make the biggest sequential alphabet possible, then use the remaining letters to make more
>>
>>57955475
who is this sweet pajeet?
>>
>>57957607

She's Lebanese. Still a degenerate, though.
>>
>>57956761
O(1) is impossible as you need to iterate through all the letters but you can do it easily in O(n) (counting sort + 1 iteration)
>>
>>57957788
Ah you're correct. I was thinking this was a common dynamic programming problem with an O(1) space solution, but you are correct. It can be done with an array of size n, where n is the length of the smaller of two strings
>>
This thread is fucking terrible.
>>
>>57955475
wait why the fuck are there two string inputs if we're making alphabet substrings based on both strings? input ['abcd, efgh'] is identical to ['abcde', 'fgh'] is identical to ['abcde', defgh'] is identical to ['abcdefgh', '']

anyways sorting a string is n log n time so i don't think it can be done any faster although i'd like to be pleasantly surprised
>>
>>57956195
this is a great solution! i would have never thought of that
-3rd year computer engineering student
>>
testing
testing
testing
>>
>>57955475
int main()
{
string in1, in2, in3;
vector<string> nig(26, ""), ger;
cin >> in1;
cin >> in2;

in3 = in1 + in2;

for (auto i : in3) {
nig[i-'a'] += i;
}
for (auto i : nig) {
int count = 0;
for (auto j = 0; j < i.size(); j++) {
if (j >= ger.size()) {
string tmp = "";
tmp += i[0];
ger.push_back(tmp);
} else {
ger[count] += i[0];
}
count++;
}
}
for (auto i : ger) {
cout << i << " ";
}
}


Be kind, first year comp engineering student.
>>
So what the fuck is a real world problem? Someone graduates with a degree in CS, what do they do as their job?
>>
>>57958288

i struggled with this as well. Really depends on the company and the services they offer or want to create. There are so many things you can do, especially when there's data to play with.
>>
>>57958288
making websites and database APIs for corporations.
>>
File: 300592-5775be0b5046c.jpg (30KB, 720x720px) Image search: [Google]
300592-5775be0b5046c.jpg
30KB, 720x720px
>>57957712
I've seen her with a penis inside her and she seemed to enjoy it, so I don't think she's lebanese. Definitely straight.
>>
>>57958277
I've been look around for how to calculate the big O for this but I'm not sure, is it n^2 because of the nested loops? Is it less because it isn't iterating over the same data twice? I'm not finding much to go on as far as formally figuring it out, just rules of thumb and guidelines.
>>
File: TravelingSalesmanProblem_1000.gif (4KB, 507x268px) Image search: [Google]
TravelingSalesmanProblem_1000.gif
4KB, 507x268px
>>57958288
Traveling salesman
>>
File: smile1.gif (2MB, 500x500px) Image search: [Google]
smile1.gif
2MB, 500x500px
>>57958374
Nice.
>>
File: 20161211_223215-1.jpg (3MB, 2156x2319px) Image search: [Google]
20161211_223215-1.jpg
3MB, 2156x2319px
you could cat the strings, sort it, and implement an unbalanced binary tree. Insert characters one at a time, equal goes left, larger goes right. For remove(node), prioritize replacing the current node with the left child node. Otherwise replace with the right node. Then for print, just start at the top and print then delete each right node until everything is gone.

Only issue is the input strings need to be sorted. Would be decently fast otherwise I think.

This was a fun problem. thx OP. Hope you get a good grade you fucking cheater.
>>
>>57958881
We had the same solution, is my implementation worth a shit, or are there better ways to do it?

My implementation: >>57958277
Thread posts: 55
Thread images: 6


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.