This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <assert.h> | |
// Angle from 0000 hrs | |
int hour_hand_angle(int hour, int min) | |
{ | |
return hour * 30 + min / 2; | |
} | |
// Angle from 0000 hrs | |
int min_hand_angle(int hour, int min) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <time.h> | |
/* Insertion Sort */ | |
void insertion_sort(long long arr[], int n) { | |
int i, j; | |
for (i = 1; i < n; i++) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.text | |
main: | |
# Print string msg1 | |
li $v0,4 # print_string syscall code = 4 | |
la $a0, msg1 # load the address of msg | |
syscall | |
# Get input n from user and save | |
li $v0,5 # read_int syscall code = 5 | |
syscall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def put_surplus_var(tab): | |
rows = len(tab) | |
cols = len(tab[0]) | |
cols_add = rows - 1 | |
tab = [x + [0]*cols_add for x in tab] | |
for i in range(1, rows): | |
for j in range(1, rows): | |
if i ==j: |
NewerOlder