Programming › Re: A "Senior" Software Developer Could Not Solve This Coding Challenge, Can You? by namikaze(op): 11:51am On Oct 12, 2022 |
Deicide: if you sorting then the time complexity is not O(n) yeah, I missed that, in the worst case it's O n log n i.e there are no duplicates but in the average the time should be lower. |
Programming › Re: .net Or Python? by namikaze: 8:33pm On Aug 31, 2022 |
Ogori8: As an engineering student, which between .net programming and python would you advice me to learn? If you're interested in anything data/ai python else .Net. It doesn't matter which you choose to learn first though, since .net is a full ecosystem its gonna more be difficult to wrap your head around. |
Programming › Re: My New Webpages, It's My First. Mentors Advice Please by namikaze: 5:13pm On Aug 19, 2022 |
TastyFriedPussy: One of the most ugly pieces of web dev sh*t I have ever seen in my life  cope |
Programming › Re: 17 Year Old aspiring Frontend Developer / Product Designer by namikaze: 8:23pm On Aug 17, 2022 |
[quote author=tensazangetsu20 post=115782462][/quote]Wow, at least they are still getting paid, they just need to improve on programming, which shouldn't be hard at these point, they're still in pretty good shape, even if they get fired lol. |
Programming › Re: 17 Year Old aspiring Frontend Developer / Product Designer by namikaze: 9:02am On Aug 17, 2022 |
SavageBoy: In order words, a solid knowledge in DSA will give one the Davidic courage to face the Goliaths of the tech industry. That's interesting. unsurprisingly yes, there's a guy I know, he'll basically get any job if he's able to land the interview, and it's not because of his stack rather it's DSA and system design, basically get so good at it that you stun the interviewer(s). |
Programming › Re: 17 Year Old aspiring Frontend Developer / Product Designer by namikaze: 8:34am On Aug 17, 2022 |
If you really want a comp. science degree well you could buy one, depends on the university though, cost is about 500k. |
Programming › Re: 17 Year Old aspiring Frontend Developer / Product Designer by namikaze: 8:29am On Aug 17, 2022 |
DrLevi: The FAANG dream is a highly ambitious one but the Leetcode DSA thing is quite real especially with established companies, I hear American devs talk about it a lot.
Still your employment will always require expertise with certain languages and frameworks because you have to be productive immediately after the onboarding.
Advising people ignore productive skills for optimisation hacks and efficiency(DSA) is quite misleading because at the end, you won't be employed as a DSA engineer but a ROR or React or Python developer. Makes no sense passing the interview only to get fired a month into the job for being totally useless to the team Onboarding in Google and generally FAANG takes 3 to 6 months, that's enough time to learn any tech stack if you're competent enough, though this is not the case for mid and smaller tech companies, you'll need a stack or language at the very least. |
Programming › Re: What Was The Hardest Language You've Learnt by namikaze: 10:40pm On Aug 16, 2022 |
MadarasBlade: I just downloaded the book lol, i am never leaving nairaland.
I was learning how to read and write maths proofs as a prerequisite for learning dsa before now, it seems this book's writing is in plain english. Thanks bro uwc. There are many other books and courses in plain English too, the book will give you a high level overview of all DSA but you'll probably need more, your knowledge of proofs would come handy some other time. |
Programming › Re: Journey To Becoming A Native Android Dev (kotlin) by namikaze: 9:52pm On Aug 15, 2022 |
TastyFriedPussy: exactly. Respects when you fork the logic in reverse cow bro style, the decency will dramatically release  werey |
Programming › Re: What Was The Hardest Language You've Learnt by namikaze: 9:49pm On Aug 15, 2022 |
tensazangetsu20: I have already read as many DSA books as I could. Grokking algorithms, computer science distilled and cracking the coding interview. Focus now is on leetcoding myself to death. Nice, for me, I decided to go a bit deeper since much of my exposure to DSA is from blog posts, random vids and the book "a common sense guide to data structures and algorithms". There are good books like clrs, algorithm design manual e.t.c but I'm not a fan large readings, evident that the book above is the only "programming" book I've completed even though I have tons of them even the ones you listed in my pdf library lol. |
Programming › Re: What Was The Hardest Language You've Learnt by namikaze: 9:52pm On Aug 14, 2022 |
tensazangetsu20: I tried learning this too. Just a huge clusterfuck. Probably cause I no send any new tools again till I get insanely good at data structures. Yeah, though the borrow checker model is actually good, if it compiles, then it's guaranteed to run. Speaking of data structures, are you doing Leetcode only? or is it in combination with a course or book. |
Programming › Re: What Was The Hardest Language You've Learnt by namikaze: 11:01am On Aug 14, 2022 |
For me it's rust, at the start it was doable but when I tried anything substantial the complexity snowballs. |
Programming › Re: Programming Is Nothing Without If & Else Prove Me Wrong by namikaze: 7:42pm On Aug 01, 2022 |
dodgelord: Programming is nothing without If & else
Prove me wrong Smiles in pattern matching. |
Programming › Re: Write An Algorithm To Shuffle An Array by namikaze: 9:48pm On Jul 23, 2022 |
|
Programming › Re: Write An Algorithm To Shuffle An Array by namikaze: 9:45pm On Jul 23, 2022 |
chukwuebuka65: Yea, but I think u didnt get the concept. If you get the concept u can fix it. What concept? unless you want me to debug your code lol. |
Programming › Re: Write An Algorithm To Shuffle An Array by namikaze: 6:20pm On Jul 23, 2022 |
chukwuebuka65: function shuffle( arr ) { Const seenArray = [ ] Const shuffledArray = [ ] for ( i=0,i<arr.length-1,i++) { let randomIndex = math.floor( math.random( ) *arr.length) If (!seenArray.include(randomIndex)) { shuffledArray [ randomIndex] = arr[i] seenArray[i] = randomIndex } else { for ( k=0,k<arr.length,k++) { If ( shuffledArray[k] == null) { shuffledArray[k] = arr[i] break; } } }
} Return shuffledArray; } God of bugs In all seriousness lots of syntax errors and even after fixing the errors does not give the desired output. I bet you typed it on nairaland. |
Programming › Re: Write An Algorithm To Shuffle An Array by namikaze: 6:00pm On Jul 23, 2022 |
chukwuebuka65: I think there is a chance this might go into infinite loop I know, this is not my solution, I was trying to remove the recursion from op's solution, mine's on the first page of the thread. |
Programming › Re: Write An Algorithm To Shuffle An Array by namikaze: 5:57pm On Jul 23, 2022 |
Deicide: That's the thing about programming if your solution is not optimised you would know. So there is always room for growth till you move to the next thing.
The randrange you used in python should also depend on random but it's abstracted though am not sure of this. No it's not like that. In my case, any value returned by the random() function would be used. In your case any value wouldn't do, it would have to return a new value not inside of the HashSet. |
Programming › Re: Write An Algorithm To Shuffle An Array by namikaze: 12:34pm On Jul 23, 2022 |
Deicide: Yeah, Things I learnt on leetcode 
Yes the complexity is dependent on the random number. So it can be infinite ): so don't try on large dataset. Another way to express your solution without the recursion would be; function shuffle(Array arr) { HashSet seenIndices = new HashSet() Array result = new Array() for (int i in 0 to arr.length()) { rand_idx = random num in range(0, arr.length()) while (seenIndices.contains(rand_idx) { rand_idx = random num in range(0, arr.length()) } result.add(arr[rand_idx]) seenIndices.add(rand_idx) } return result; } This I think follows the same idea, but would still depend on the random function, so not recommended. |
Programming › Re: Write An Algorithm To Shuffle An Array by namikaze: 12:05pm On Jul 23, 2022 |
Deicide: That's why this code wouldn't work if they we duplicate in the input array. Who knows maybe if I stroll out later the solution might come to my head  You should definitely go for walk  You used the hashset to reduce lookup from O(n) to O(1) didn't you? nice one. Also an instance where random() keeps returning an index to a value that's already in the hashset continuously till count gets to zero would yield undesired results. |
Programming › Re: Write An Algorithm To Shuffle An Array by namikaze: 11:46am On Jul 23, 2022 |
Deicide: like this shuffle([1,2,3,4,5], 5);
5 here is the length of the vector. Ok sure. |
Programming › Re: Write An Algorithm To Shuffle An Array by namikaze: 11:44am On Jul 23, 2022 |
Deicide: Even on reddit they would advise you not to implement a double linked list or even a Linked list in rust exexpt you wanna run mad But you can use Box<T> to make the running mad slower 
My code actually runs fast despite the recursion, it mostly just depends on if it gets the random number right. Best case would be O(n) but that's impossible but it can happen just that the chance are small especially if the input is large.
I'll rewrite this code in C++ so I can test the complexity properly. The lazy_load for HasSet I did up there I don't have the crate for it  I remember the Box<T> construct lol, and to think I was able to implement a linkedlist (single) in it  I don't think I have the code anymore but I'll check my GitHub later. Ofcourse it would run fast, rust if fast af. I do think it's not that great to let your algorithm depend on "picking the right number" but I get you. |
Programming › Re: Write An Algorithm To Shuffle An Array by namikaze: 11:37am On Jul 23, 2022 |
Deicide: That's the base case of the recursion; if that's not there the code would run forever Ok, say for instance I called the function on a vector, [1,2,3,4,5]; what would pass as argument for the count parameter? |
Programming › Re: Write An Algorithm To Shuffle An Array by namikaze: 11:29am On Jul 23, 2022 |
Deicide: It'll be easy with Js Sorry, what's the role of the count parameter? |
Programming › Re: Write An Algorithm To Shuffle An Array by namikaze: 11:24am On Jul 23, 2022 |
Deicide: Yeah I agree there are something that are Impossible in rust without using the unsafe key work like improbable did in my code to reduce time & space complexity. But I love the language it makes you as a programmer to be very careful with what you write.
Can you guess the complexity of my code since lookup in a hashmap is O(1) so am thing O(n^2 + random(n)) I don't even know what that means  My guy even with the unsafe keyword it gets complex real quick, I know what I faced when I tried implementing a doubly linkedlist in Rust, it was crazy. Memory management in C/C++ is much simpler than in Rust. I agree though learning rust will make you better developer overall. Guy you're brave, using recursion inside a while loop, I hail thee loolz, well let me see if I can figure out the complexity... |
Programming › Re: Write An Algorithm To Shuffle An Array by namikaze: 10:44am On Jul 23, 2022 |
Deicide: Nice one  I modified my post, check it out. |
Programming › Re: Write An Algorithm To Shuffle An Array by namikaze: 10:42am On Jul 23, 2022 |
|
Programming › Re: Write An Algorithm To Shuffle An Array by namikaze: 10:32am On Jul 23, 2022 |
Deicide: Was able to come up with this using rust. ... Can someone improve on this? use whatever programming language you like. And are there other rust programmers on this section? Complexity of this code? O(2^n) yeah it's that terrible.
There is a problem that causes infinity loop in this code can you spot it? from random import randrange
def shuffle(arr): for i in range(len(arr)): rand_idx = randrange(len(arr)) arr[rand_idx], arr[i] = arr[i], arr[rand_idx] return arr arr = [1,2,3,4,5] print(shuffle(arr)) Here's something pretty simple, time complexity should be O (n log n), since the time complexity of the randrange function is O (log n). It's being quite a while since I did anything in rust, I don't want to fight the borrow checker right now  Rust used to be my favorite language but it's just too painful to do anything substantial with it, try implementing a doubly linkeldlist in Rust and you'll agree that C++ is easy compared to Rust. |
Programming › Re: Why Does Everyone Think Javascript Is Hard? by namikaze: 10:10am On Jul 14, 2022 |
benalvino3: I apologize if i wrongly tagged you... it is not a matter of preference because both of them do not do the same thing or try to solve the same problem. CSS is not an alternative to c++ that is the point I am trying to make. it will make sense to say i rather touch C++ over C, go, java, c#, etc than CSS. I believe I'm the one you wanted to quote. What I'm really saying is, I'd rather implement a functionality in C++ (difficult lang) than design something in CSS, obviously it's not directly comparison. |
Programming › Re: Why Does Everyone Think Javascript Is Hard? by namikaze: 9:57am On Jul 14, 2022 |
truthCoder: learn tailwind css.
thank me later Sure, thanks. |
Programming › Re: Why Does Everyone Think Javascript Is Hard? by namikaze: 9:55am On Jul 14, 2022 |
LienwaltAbel: I still dey try find my level . It's been long since I last programmed, I'm thinking of getting back to learning python and C++ Sha. Then I'll try my luck with gameplay programming and backend (maybe). The issue now is that I need money for laptop (I'm on that for now). Ma guy gameplay dry o, hope say you know wetin dey sup currently. Backend and mobile dev seem the most reasonable right now, front end dev is getting saturated. |
Programming › Re: Why Does Everyone Think Javascript Is Hard? by namikaze: 11:12pm On Jul 11, 2022 |
silento: If u know basic fundamental concepts of programming
You can learn any language and build complex stuff with it under two weeks
Css is also not hard , c is the hardest language I have come across
Am not talking about c improved with libraries All the higher languages allows u to mess up and get away with it
You see pointer in c language na there most people dey run and that's the most powerful stuff in c language
If u understand pointer in c language very well Just know u are good to go
Am talking from experience
If u are not in a hurry to make money start programming with c language then try to understand the fundamental concepts of programming
Syntax Variable Datatypes and structures Operators Decision making Loops Files IO Function and oop then if language supports oop
This are things u need to understand very well and u will see programming is very easy and fun Why would you consider C the most difficult? pointers? memory management? C is not that hard to me, however it requires you to implement the basic things that come built-in in other languages, which is where I agree the difficulty really creeps in. |