You are on page 1of 9

Computational thinking full summary

Sample datasets
Classroom Dataset –

• The card carries the following fields:


• Unique id no: value 9 in the card above
• Name of student Gender: M for Male and F for Female
• Date of Birth: Only the day and month is recorded as it is sufficient for the questions that we will
be asking related to this field
• Town/City
• Marks in Mathematics, Physics, Chemistry and the Total of these three marks
• The dataset has 30 such cards with a mixture of Male and Female students from different cities.
• Example questions are:
1) Which students are doing well in each subject and overall ?
2) Are the girls doing better than the boys?
3) Can we group students based on their performance?
4) Are there any two students born on the same day and month?
5) Are those scoring high marks in Maths also scoring high in Physics?
6) Can we make pairs (A,B) of students in such a way that A can help B in one subject, while B can help
A in another subject?

Shopping Bill Dataset –

The card carries the following fields:


• Unique id no: value 1 in the card above
• Name of store: SV Stores
• Name of the customer: Srivatsan
• List of items purchased: Item name, category name/sub category name, Quantity purchased,
Price per unit, Cost of item purchased
• Total bill value

Example questions are:


• Which customer is spending the most? Which shop is earning more revenues?
• Are the high spenders shopping at the higher revenue shops?
• Which category is selling more?
• Which shop attracts the most number of loyal customers (those who go only to one shop)?
• Which customers are similar to each other in terms of their shopping behavior ?

Words dataset
• The card carries the following fields:
• Unique id no: values 0 to 3 in the cards above
• The word itself
• Part of speech or word category: Pronoun, Verb, Noun
• Letter count: 2, 3, 6 and 7 respectively for the cards above.

Example questions are:


• How many sentences does the paragraph have?
• Which words are occurring with high frequency?
• Are the higher frequency words shorter?
• How does one resolve the pronoun to a personal noun?
• Is the paragraph coherent (i.e. talking about a connected set of nouns)?

Repetition - The most common form of computation is a repetition.

Iterator - The pattern of doing something repetitively is called an iterator.

Initialization - The steps involved to setup the required context for the iterator to function is collectively
called initialisation.

Description of the iterator


To summarise, the iterator will execute the following steps one after the other:
• Step 1: Initialization step: arrange all the cards in an "unseen" pile
• Step 2: Continue or exit? if there are no more cards in the "unseen" pile, we exit otherwise we
continue.
• Step 3: Repeat step: pick an element from the "unseen" pile, do whatever we want to with this
element, and then move it to another "seen" pile.
• Step 4: Go back to Step 2

Flowcharts
The step-wise description of the iterator that we saw in the previous section can be
visualized nicely using a diagram called a flowchart.

Main symbols used in flowcharts


The generic Iterator flowchart

Basic datatypes –
Records and list

Record (also called struct or tuple)


List

• A sequence of data elements (for example a sequence of records)


• Marks Card List - is the data type for our data set of all marks cards
• Each element in the sequence is of Marks Card Record data type
• Paragraph Word List - is the data type for our word data set
• Each element in the sequence is of Word In Para Record data type
• Shopping Bill List - data type for the shopping bill data set
• We need to define the Record data type for a shopping bill
Flowcharts –

Process in words –
Step 0 Start
Step 1 Initialize Count to 0
Step 2 Check cards in Pile 1
Step 3 If no more cards, go Step 8
Step 4 Pick a card X from Pile 1
Step 5 Move X to Pile 2
Step 6 Increment Count
Step 7 Go back to Step 2
Step 8 End

Advantages
• Visual representation of computation
• Easy to understand
Disadvantages
• Size: Complex processes generate large flowcharts
• Collaboration: Sharing pictures in editable format
• Versions: Compare changes between flowcharts
o Start
o Count = 0
o More cards
o in Pile 1?
o Pick a card
o X from Pile 1
o Move X to Pile 2
o Increment

If statement - An if statement is a programming conditional statement that, if proved true,


performs a function or displays information.

While condition - The while construct consists of a block of code and a condition/expression.

Accumulator - pattern in which something is accumulated during the iteration is simply


called an accumulator and the variable used in such a pattern is called an accumulator variable.

Reducing number of comparisons ( using binning )

You might also like