Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Software pushups

Name: Anonymous 2014-11-24 23:01

Let's exercise together, /prog/!

1) Write a subroutine that accepts an array of unsigned ints and returns 4. It must operate on the array in-place and partition it so that all nonzero values are at the beginning of the array, and all zero values are moved to the end. For example, the input [0, 2, 0, 0, 4, 1, 4, 5] could be changed to [2, 4, 1, 4, 5, 0, 0, 0]. The relative order of the nonzero values is unimportant.

Name: Anonymous 2014-12-03 21:13

Okay /prog/! Let's keep moving forward and all become satori programmers together! Yeah!

2) Write a program that simulates physical card shuffling by partitoning and merging the deck. You can do this in place or using temporary structures at your own discretion, and you can use as many helper functions as you like.

The input will always contain 52 cards. You can represent them as pairs of characters (strings, tuples, etc.) identifying rank and suite: "6H" is the six of hearts, "AS" is the ace of spades, "XC" is the ten of clubs, and "QD" is the queen of diamonds. You can generate your own input in sorted order or hard-code a particular deck.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List