2

HELP! Stack overflow did not take this question! I want to learn code! How can I learn code if they won’t help! Question was:

CS 101 take home assignment question 1: write a function to determine if an array of numbers is sorted. The function must return true if it is, false otherwise.

@Fast-Nop , @Root , @theabbie please. I have a week to get this question done 😭

Comments
  • 7
    Since it's an assignment, I won't give a solution, but, I can point you in the right direction, By the definition of sorting, any element on right must be bigger than one on left, just verify this from left to right for consecutive pairs, if false for any one pair, it's not sorted.
  • 3
    the reason why they won't help is that of SO not made to do your homework. theabbie already gave you pointers, but this is far too simple to even consider without you even mentioning what you have tried beforehand.

    A simple solution would be to sort the array(using standard lib functionality or a basic sorting algo) and compare the elements of what was passed to what was expected, there is your true false. There are more elaborate solutions, but if you can't determine a simple algo like this one and then ask....then yeah, SO will throw you under the bus. Test, try it, write code and if it doesn't work then ask a question. This is a scientific field man, you need to show what you have done already.
  • 0
    @AleCx04 thank you! Now can you teach me to hack? My alter ego d-fanelli yelled at me now Im sad
  • 0
    Still wait for @Fast-Nop as he is hero of code
  • 2
    This is an elementary task. You should figure it out yourself.
  • 0
    @iiii it was hard since it was assigned april 1 by d-fanelli
  • 1
    @TeachMeCode no, teach yourself man. Don't ask others to help you with this. The best teacher you are going to get is your own experience.

    Try freecodecamp
  • 8
    You need to treat the array as an individual and ask it if it identifies as being sorted. It’s not for you to decide, it’s all about how the array feels and you have no right to put labels on it.
  • 4
    There was a @d-fanelli where did it go? Is this some joke?

    Nevermind, got it, you changed username, but, is it still a joke?
  • 0
    @UnicornPoo dafuq? 🤣
  • 1
    You're too late! Your homework was due yesterday, April 1st!
  • 1
    Also this assignment shouldn't return a bool, it should return an int. The value returned indicates how sorted the array is at the time.
  • 2
    @TeachMeCode Yo mama thought contraception was an April fool.
  • 2
    I stretched the rules a bit by posting on April 2 but this rant was just an April fools joke lol. I wanted to masquerade as the typical lazy/dumb programmer we bump into often that can’t use the right tag, can’t write the simplest code and can’t use a search engine. I provided hints in the tags that it’s an April fools joke in case people take it seriously (bc it was posted after April 1). Sadly I can’t change my username for another six months and I’m kinda pissed at that lol....This is d-fanelli, btw
  • 0
    @AleCx04 April fools 🤣
  • 1
    @TeachMeCode your new username is hilarious 😂
  • 1
    @TeachMeCode you've played yourself
  • 1
    @theabbie to be fair that pretty much answers the question as much as you can without knowing the specific language this has to be done in
  • 3
    @Tonnoman0909 I can find you people who claim to know programming but can't implement it even with that information, I am pretty sure those people won't know how to break out of loop and check whether it was a break or normal termination, by setting flags.
  • 2
    @theabbie but that sounds like an issue with language knowledge rather than problem solving which is something that can mostly be fixed with doc reading, not asking in forums
  • 4
    @Tonnoman0909 Maybe it was a language assignment and not algorithms assignment, so, giving away algorithm won't be that bad as he still needs to implement which requires knowledge of that language, anyways, this was April Fools Joke.
  • 1
  • 1
    Sorry guys, this was an April fools joke mocking people who post homework thats super trivial without even getting the tags right. Yes we were all new at some point but most of us hopefully resorted to google without wasting other people’s time. Then again this question should be simple enough without even needing google
Add Comment