Does this count as an InsertionSort
So i need to program an Insertionsort for my school and i just wanted to ask if this would count as one. I does sort the numbers atleast.
22 Replies
Come on man, actually paste the code here, please
Don't make us squint at a quite bad picture of some code on a screen
Sorry im on it rn booting up my laptop ill send a screenshot any second
i hope this is better
$code
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
For longer snippets, use: https://paste.mod.gg/I don't see how that can be an insertion sort, no
I don't see how it could actually sort correctly either
The teacher said that we should always check the number before it and then swap them out so like if we have [2,5,7,4] it should firstly look is the numer bigger then if yes then leave it if it is smalle rthen change it and that till it is right and he called it an insertionsort do idk tbh
Can you post your actual code, rather than a screenshot, so we can run it
If that code actually works you'll win a prize or something -- there's no sorting algorithm which works using a single pass through the array
Yea sure do i need to use some kind of command or just paste it in here
here is the code:
$code
To post C# code type the following:
```cs
// code here
```
Get an example by typing
$codegif
in chat
For longer snippets, use: https://paste.mod.gg/$codegif
Ohh sorry ill do that
Oh sorry, I misread your loop
Let's read it again...
I think that's doing like a reverse bubble sort
Im sorry a what?ðŸ˜
Okay ill read it but ty for the help
Ah no you're right, that is an in-place insertion sort
I take that all back 😛 It's late and I'm tired, that's my excuse
Ohh okay okay ty for the help! I was kinda scared because the teacher just said yh make an insertionsort and i tried to understand what he said but he just rushed over it and stopped with the lesson 🥲 and i need it till tomorrow so yhhh😠ty again