A list comprehension is a special syntax in some programming languages to describe lists. It is similar to the way mathematicians describe sets, with
Continue ReadingC++ Full Course Lesson 6: Variables Memory Concepts
https://www.youtube.com/watch?v=3Iq_uFbc4L4&index=6&list=PLAE85DE8440AA6B83
Continue ReadingC++: Loop Over Multiple Arrays Simultaneously
Loop over multiple arrays (or lists or tuples or whatever they're called in your language) and print the ith element of each. Use your language's "for
Continue ReadingC++: Nested Loops
Show a nested loop which searches a two-dimensional array filled with random numbers uniformly distributed over . The loops iterate rows and columns o
Continue ReadingC++: Knight’s Tour
Problem: you have a standard 8x8 chessboard, empty but for a single knight on some square. Your task is to emit a series of legal knight moves that re
Continue ReadingC++: Multiple Distinct Objects
Create a sequence (array, list, whatever) consisting of n distinct, initialized items of the same type. n should be determined at runtime. By disti
Continue ReadingC++: Multiplication Tables
Produce a formatted 12×12 multiplication table of the kind memorised by rote when in primary school. Only print the top half triangle of products.
Continue ReadingC++: Knuth’s Algorithm S
This is a method of randomly sampling n items from a set of M items, with equal probability; where M >= n and M, the number of items is unknown unt
Continue ReadingC++: Horner’s Rule for Polynomial Evaluation
A fast scheme for evaluating a polynomial such as: when . is to arrange the computation as follows: And compute the result f
Continue ReadingC++: Ludic Numbers
Ludic numbers are related to prime numbers as they are generated by a sieve quite like the Sieve of Eratosthenes is used to generate prime numbers.
Continue Reading