CS2100: Encoding / Instruction Format

Why is addi only take 3 instruction?EncodingEach mips instruction is a fixed length of 32 bits. Each register that is in letters will be translated into numbers from 0-31 (32 register). We need 5 bits for the register.Opcode -  Specifies the instructionfunct - Combine with opcode to specify the inst... [Read More]

CS2040s: Lab 2

Binary Heap Recap/ Binomial HeapThe top will always be the minimum or the maximum depending if it is a min heap or max heapMakeHeap (1)Insert (logn)Minimum (1)ExtractMax(logn) // Swap wif last index, extractExtractmin (logn)Union (n)Decrease - key (logn)Delete (logn)Each Child is the parent /2Binomial Heap is a collection of binomial... [Read More]

ES2660: [Homework] "The welcome" Reflection

“THE WELCOME” – REFLECTING CRITICALLY What is your critical reflection on the video in response to the challenge at the end of the video – would you share it to stand up for human rights? What guidelines do you use to decide what to share?Submit your response (300 words) to... [Read More]

CS2100: MIPs Memory and Branch

MIPS: Memory and BranchMemoryOrganisationThe main memory is a one dimension array with each location of the memory with an address wherek-bit address = 2^k locationse.g 4 bit  = 16 location0000 to 1111Each memory slot (Byte) is 8 bitsTransfer unitByte addressableWord is 2^n bytes However, machines can only be one of each... [Read More]

CS2040s - Binary heap and Priority Queue

Priority QueueIts automatically sorted and sorted based on the comparator provided. Technically, a heap is a priority queue..Problem:Each patient is assigned a priority score and the doctors will look at the patients that needed help first.What operations do we need to support?Operations: insert(x) : inserts x max() : returns element... [Read More]

GES1011 - Lecture 3: Text on Singapore's past

Recap:- Human conversation mainly about singapore's past present and future in a global context-  Geological unfolding- Biological unfolding- The spread of humans from africa to all around the worldLecture:- Make sense of text (Sulalat al-salatin)- Perusing a second source (Arch data)- attempt to interpret Singapore's past- Learning two concepts commonly... [Read More]

GES1011 - Learning Journey

Your participation marks consist of your contributions during class discussions (including online forums) AND a learning journal.This journal can be a word document (or pdf) and may be thought of as an exercise in writing blog entries. So, construct five short entries on anything (idea, topic, reading, image) that is... [Read More]

GEQ1000 - Tutorial 1

How many questions per hour do children ask per hour- 45 Questions per hour- Food- Change Toys- Sleep- Bed time story- Ask surrounds/ peopleGroup 1: 20- Toys occupy time -> less question- Bored -> Question- Children ask alot of questionsGroup 2: 25- Lunch -> Q^Group 3: 15- Age< x ->... [Read More]

ES2660 - Indians and PRC

Look at an article and apply barrett's taxonomy.Mining for information:We can Ask questions to get more information.E.gWhat's the source? Is there an agenda? Who is the author?Case study:ArticleOpinions:- Use the practical consideration as a mask for discrimination/prejudice against certain races- Individualistic racism where even thou the law applies to the... [Read More]

ES2660 - WildCard #3 I want something just like this

Talk about the underlying assumption made by the suppose singer of the song1.  Comparison- He assume that he is not good enough.- Described all good things about people- "Clearly I don't see myself upon that list"- Assume that he is not as good as those people in the listLinked- Perceived... [Read More]

CS2100: MIPS Introduction

MIPS IntroductionWe can retrieve the assembly code by running this command on a c prog-> gcc -s hello.c//this will generate a .s file which is the assembly codevim hello.sExecution walkthrough1. Read2. Process Figure/ decode3. Fetch oprands4. Execute5. StorebackHowever, memory access is slower than process speed thus we have to avoid... [Read More]

CS2100: Structure and Array

ArrayArray is size fixed and cannot be changedWe declare array like int arr[5] = { 1,2,3,4,5}If we leave the [] empty, compiler will count for us.In the memory, the name refers to the address of the first element. The elements are also consecutive.This is similar in java and python.When passing it... [Read More]

CS2040S: Tutorial 1

Time complexityProblem 1Q1.T(N)S(1)Reason: The second for loop is unreachable so it only runs one loopQ2.T(1)S(1)Reason: It does not rely on input x (Independent of input) so the run time is always the same no matter what.Q3.T(1)S(1)The function look like it depends as n but we are considering large n.For Large... [Read More]

CS2100: Tutorial 1

1.Whats the significance of this number?a) Its the upper bound0x7FFFFFFThe first digit is 7 because of negative number.b)0x7FFFFFFd)We are using 2 complement.Why not 1's complement:Its easier but when we do integer addition and subtraction, the extra one step to add the number is very taxing.e) Java (If it exceeds, it... [Read More]

GES1011: Tutorial 1

1. Marwick says that we should not use history and past as synonyms.Past is not history.The past occurred previously and now we are occuring in the history.These are traces of the past.During lecture, we discuss about the trace of singapore, the singapore stone.All the traces we gather are in the... [Read More]

CS2040S: Lecture 5 - QuickSort

Quick sortDoes a clever split, a recursive solve and trivial combinefunction Quicksort(A, low, high)if low < high p = Partition(A, low, high) //splitQuicksort (A, low, p-1) //recursiveQuicksort (A, p+1, high) Lumoto's partition algo:function Partition(A, low, high)       v = A[low]      m = low     i = low//Initialisation       for... [Read More]

CS2040s: Binary search and Merge sort

Problem: Find customers spending between $a and $b where b>aHow fast can we find customer who spend $a in an unsorted array?-> o(n) [Linear search]We are not given any information so we have to look one by one.BUT!!! Our array is sorted..Strategy: Exploiting structureIf our Array is already sorted, and... [Read More]

GES1011: Lecture 2

Recap:- How old is singapore? -> It depends :)- Why did we not question our geological context?-> It has continuously and even right now experience changes-> Island in the regio have disappear in the last 150 - 200 yearsRaffles came around this times, but how come we didnt take note... [Read More]

ES2660: Jack and the beanstalk (Group discussion)

Elements:- The cow- Beans- He climb the beanstalk- Mother angry- Poor- Goose that lays golden eggs- Giant- They both smell english man blood- Golden harp- Chop the bean stalkDifferent:- Wife- Old woman- Castle backstory- Fairyland- Death giant- One took both obj, the other only one- Move in the castle and... [Read More]