Board List | Page List: 1 |
---|---|
Topic | On a scale of 1-10 how juvenile am i? (prog. assignment) |
IllegalAlien 11/03/18 3:33:48 PM #33 | He's stealing code from the internet. I gave him a challenge to make it better in a very simple manner which would require Googling how a Python dict works (yknow like a real programmer). Also you didn't tell him to ignore my advice, you told him I was wrong. I've shown that I'm not wrong. Your condescending attitude about a simple issue that someone with very basic Python skills would understand is really hilarious. --- "Never argue with an idiot, they drag you down to their level, then beat you with experience." |
Topic | On a scale of 1-10 how juvenile am i? (prog. assignment) |
IllegalAlien 11/03/18 3:32:34 PM #32 | Try running it multiple times since its stochastic. You'll find a difference of up to 2x slower in the two loop case. Not sure how you fixed my code, besides adding "print dictionary" lol which of course would mask the empirical running time with the extra operations to print the dictionary... Anyways, clearly you're trying to dick measure for some reason after I've shown you in literal code that there is a more optimal way to do this. Indeed in a purely algorithmic sense the two loop implementation is twice as much work (modulo some other factors), but in a real implementation due to optimizations there is some savings but it's still empirically slower by up to 2 times. --- "Never argue with an idiot, they drag you down to their level, then beat you with experience." |
Topic | On a scale of 1-10 how juvenile am i? (prog. assignment) |
IllegalAlien 11/03/18 2:46:46 PM #30 | 1. He's copying code from the internet 2. You're saying a lot of stuff but ultimately you're giving him bad advice and telling him to ignore my good advice. 3. This pisses me off. 4. Run this code in your IDE and tell me which one is faster. Now try it with a longer string and tell me again. import time def string_to_dict_2_loops(string): dictionary = {} for char in string: dictionary[char] = 0 for char in string: dictionary[char] += 1 return dictionary def string_to_dict_1_loop(string): dictionary = {} for char in string: if char in dictionary: dictionary[char] += 1 else: dictionary[char] = 0 return dictionary def average_time(n, func, string): total = 0 for i in range(n): start = time.time() func(string) total += time.time()-start return total / n result1 = average_time(100, string_to_dict_2_loops, "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?") result2 = average_time(100, string_to_dict_1_loop, "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?") print "Average time per two loops: " + str(result1) print "Average time per single loop: " + str(result2) --- "Never argue with an idiot, they drag you down to their level, then beat you with experience." |
Topic | On a scale of 1-10 how juvenile am i? (prog. assignment) |
IllegalAlien 11/03/18 12:26:14 PM #28 | There's some consideration to be thought of when the alphabet size is comparable to the string length. But it's not hard to imagine the case of a finite alphabet (say 26 chars) and an arbitrarily long string. Essentially, don't say bullshit if you don't know what you're talking about. --- "Never argue with an idiot, they drag you down to their level, then beat you with experience." |
Topic | On a scale of 1-10 how juvenile am i? (prog. assignment) |
IllegalAlien 11/03/18 12:24:21 PM #27 | I mean if you have a basic understanding of Python dicts and a basic understanding of asymptotic analysis you can clearly see he's doing twice the amount of work. Since you can do it in 1 loop. --- "Never argue with an idiot, they drag you down to their level, then beat you with experience." |
Topic | On a scale of 1-10 how juvenile am i? (prog. assignment) |
IllegalAlien 11/02/18 10:58:48 PM #20 | In Python, you can do it in a single loop with only basic understanding of Python dicts. OP is already stealing the code from the internet, but I like that he's trying to understand it at least. I'm not going to give the answer. --- "Never argue with an idiot, they drag you down to their level, then beat you with experience." |
Topic | On a scale of 1-10 how juvenile am i? (prog. assignment) |
IllegalAlien 11/02/18 10:50:07 PM #17 | Questionmarktarius posted... LookANinja posted...Ahhh okay. And defaultdic automatically makes it 0? He's using two loops. One to initialize the dict to all 0. One to count the chars. It can obviously be reduced to a single loop. --- "Never argue with an idiot, they drag you down to their level, then beat you with experience." |
Topic | On a scale of 1-10 how juvenile am i? (prog. assignment) |
IllegalAlien 11/02/18 10:46:15 PM #16 | You're doing twice the amount of work you need to do by iterating over the string twice. --- "Never argue with an idiot, they drag you down to their level, then beat you with experience." |
Topic | I've got 2 semesters of basically nothing, what should I double major in? |
IllegalAlien 11/02/18 10:10:49 PM #21 | Garioshi posted... IllegalAlien posted...CS, EE, CE. Physics will complement any of these nicely and these will actually get you a job outside of academia. It depends on your school, in some schools you may end up just proving things at the upper level. Pretty much for CS once you pass the basic programming sequence you can end up taking classes which are heavy on the implementation side or pure theory. If you're good at proofs then the theoretical CS classes will be just like any other proof based course. For programming, some courses like Operating Systems may actually have you implement major components of a basic OS (or network protocol, etc). For an undergrad this can be very overwhelming indeed. --- "Never argue with an idiot, they drag you down to their level, then beat you with experience." |
Topic | I've got 2 semesters of basically nothing, what should I double major in? |
IllegalAlien 11/02/18 9:46:03 PM #16 | CS, EE, CE. Physics will complement any of these nicely and these will actually get you a job outside of academia. --- "Never argue with an idiot, they drag you down to their level, then beat you with experience." |
Topic | University threatens police investigations for offensive Halloween costumes |
IllegalAlien 10/25/18 9:53:16 PM #6 | foxnews.com --- "Never argue with an idiot, they drag you down to their level, then beat you with experience." |
Topic | New social media site coming about on college campuses. |
IllegalAlien 10/22/18 11:34:03 PM #54 | Why the fuck are all of you people still on CE in 2018 shitposting about politics holy shit it's been over a decade by now --- "Never argue with an idiot, they drag you down to their level, then beat you with experience." |
Topic | Anybody like Ozark? |
IllegalAlien 09/17/18 10:27:37 PM #4 | I'm watching it now and I love it --- "Never argue with an idiot, they drag you down to their level, then beat you with experience." |
Topic | Just declined a 52k job cause the pay was too low. |
IllegalAlien 08/31/18 8:19:11 PM #58 | It really depends on cost of living. However I don't believe the field you're applying to will plausibly pay you 80k. --- "Never argue with an idiot, they drag you down to their level, then beat you with experience." |
Topic | Trump and the NYT have rather different accounts of their meeting |
IllegalAlien 07/29/18 12:44:39 PM #4 | lmao what a jackass --- "Never argue with an idiot, they drag you down to their level, then beat you with experience." |
Topic | I think people honestly overrate STEM degrees |
IllegalAlien 07/28/18 9:50:44 PM #64 | I have a MS in CS and I recently took an offer for 70k in Denver. (For comparison Comcast Software Engineer II was 55-65k during my interview). It's about par for the market given my experience, but in 2-3 years I'll be worth 100k+ easily since it's a .NET position. Unfortunately Denver seems to be slightly anti-intellectual and recruiters really want specific tech stacks. It also took me a month to find my job. Some might say that this is fast, but the entry level market felt pretty bad IMO. --- "Never argue with an idiot, they drag you down to their level, then beat you with experience." |
Topic | Cohen says Trump was aware of the meeting his son had with RussiansTo be clear, |
IllegalAlien 07/27/18 12:41:20 AM #79 | BakedStuffEtc posted... "b-but he talks to Russians!" There's actually a good amount of evidence that many state's election software was hacked. There was a huge thread on Reddit about it. I'm not really responding to you btw since I know you're either trolling or too blind to care about reason. This is more for other people. --- "Never argue with an idiot, they drag you down to their level, then beat you with experience." |
Topic | Should I wear a tie to my interview tomorrow morning? |
IllegalAlien 07/25/18 10:15:41 PM #14 | Dude, I wear a tie to software engineer interviews. Wear the damn tie. --- "Never argue with an idiot, they drag you down to their level, then beat you with experience." |
Topic | The James Gunn reaction proves that Roseanne's firing was political |
IllegalAlien 07/25/18 11:56:51 AM #24 | User Since: Jul 2018 Karma: 17 Active Posts: 105 Total Badges: 4 Gate CE by karma already holy shit. Enough of these alts it's fucking pathetic. --- "Never argue with an idiot, they drag you down to their level, then beat you with experience." |
Board List | Page List: 1 |