Help me?? Give me task... | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Help me?? Give me task...

Hey I am learning c ++. And I need someone to give me some programs to write upto using functions. Like adding numbers etc

2nd Dec 2017, 1:47 PM
Gplayer
Gplayer - avatar
10 Answers
+ 6
Let me give you a particular task. Resource adapted from somewhere. Insertion Sort is a simple sorting algorithm that works the way we sort playing cards in our hands. We sort the first two cards and then place the third card in the appropriate position within the first two, and then the fourth is positioned within the first three, and so on until the whole hand is sorted. During an iteration, an element of the list is inserted into the sorted portion of the array to its left. So, basically, for each iteration, we have an array of sorted elements to the left, and an array of other elements still to be sorted to the right. Sounds confusing? Let's look at an example to better understand the algorithm. Take the following array: [3, 1, 5, 2] Step 1: We start with the second element (1) and properly position it in the "array" of the first two elements. Result: [1, 3, 5, 2] - now we have a sorted array to the left ([1, 3]), and the other elements to the right. Step 2: The next element is 5. Inserting it into the array to the left results in [1, 3, 5, 2]. Step 3: The last element (2) is inserted into the corresponding position, resulting in: [1, 2, 3, 5]
2nd Dec 2017, 1:59 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 6
@Pegasus List sorting is more fun than I would've thought. There are some cool ones on YouTube that represent how it sorts via audio, those are really neat.
2nd Dec 2017, 1:57 PM
Ahri Fox
Ahri Fox - avatar
+ 3
Okay. Make a program that sorts a list. Search for efficient list sorting methods and implement it
2nd Dec 2017, 1:54 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
Ohhhhhhbh now I understand so basically sort numbers according to thier um increasing value. Thanks bro ✊ ✊ i'll post it here tomorro.
2nd Dec 2017, 2:58 PM
Gplayer
Gplayer - avatar
+ 2
List according to its char length?? I don't wanna search I want to so it on my own. And why the suck u giving hard question
2nd Dec 2017, 1:56 PM
Gplayer
Gplayer - avatar
+ 2
@Ahri Fox Not to mention lesson factory lessons on it :)
2nd Dec 2017, 1:58 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
I am also a noob don't worry 😊
2nd Dec 2017, 3:25 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 1
Nope. I mean, like using bubble sort, insertion sort, etc. It's pretty medium. An opportunity to improve skils for beginners
2nd Dec 2017, 1:57 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 1
Okay. This is one of the sorting algorithms. There are others but this is one of the easier ones
2nd Dec 2017, 3:00 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 1
Thanks 🙏 I forgot to mention I was noob 😂 😹😹
2nd Dec 2017, 3:23 PM
Gplayer
Gplayer - avatar