Skip to content

Instantly share code, notes, and snippets.

@mohamed-ennahdi
mohamed-ennahdi / TwosComplementBinaryMultiplication.c
Created February 24, 2014 03:48
Two's Complement Binary Multiplication
//*******************************************************************
// File: TwosComplementBinaryMultiplication.c
// Author(s): Mohamed Ennahdi El Idrissi
// Date: 06-Aug-2012
//
// Input Files: NONE
// Output Files: NONE
// Description: CSC 2304 - <Computer Architecture and Organization>
// <Computer Arithmetic>
// This program implements the Two's Complement Binary Multiplication algorithm
@mohamed-ennahdi
mohamed-ennahdi / TwosComplementBinaryDivision.c
Created February 24, 2014 03:49
Two's Complement Binary Division
//*******************************************************************
// File: TwosComplementBinaryDivision.c
// Author(s): Mohamed Ennahdi El Idrissi
// Date: 06-Aug-2012
//
// Input Files: NONE
// Output Files: NONE
// Description: CSC 2304 - <Computer Architecture and Organization>
// <Computer Arithmetic>
// This program implements the Two's Complement Binary Division algorithm
@mohamed-ennahdi
mohamed-ennahdi / IEEE754NumberConversion.c
Created February 24, 2014 03:52
IEEE 754 Number Conversion
/*
* Mohamed Ennahdi El Idrissi
* CSC 2304 - Computer Organization and Architecture
*
* Converting a given number:
* - from Real Number to IEEE 754
* - from IEEE 754 to Real Number
*/
#include <stdio.h>
#include <math.h>
@mohamed-ennahdi
mohamed-ennahdi / UnsignedBinaryDivision.c
Created February 24, 2014 03:53
Unsigned Binary Division
//*******************************************************************
// File: UnsignedBinaryDivision.c
// Author(s): Mohamed Ennahdi El Idrissi
// Date: 06-Aug-2012
//
// Input Files: NONE
// Output Files: NONE
// Description: CSC 2304 - <Computer Architecture and Organization>
// <Computer Arithmetic>
// This program implements the Unsigned Binary Division algorithm
@mohamed-ennahdi
mohamed-ennahdi / UnsignedBinaryMultiplication.c
Last active August 29, 2015 13:56
Unsigned Binary Multiplication
//*******************************************************************
// File: UnsignedBinaryMultiplication.c
// Author(s): Mohamed Ennahdi El Idrissi
// Date: 06-Aug-2012
//
// Input Files: NONE
// Output Files: NONE
// Description: CSC 2304 - <Computer Architecture and Organization>
// <Computer Arithmetic>
// This program implements the Unsigned Binary Multiplication algorithm
@mohamed-ennahdi
mohamed-ennahdi / HuffmanEncoding(ContestVersion).c
Created February 24, 2014 03:59
A contest Huffman Encoding Problem. This solution is expensive from an algorithm analysis perspective (unsuitable data structure preliminary choice). However, the algorithm is worth it.
#include <stdio.h>
#define N 26
/*
* This structure gathers the elements (letters) and their frequency.
*/
typedef struct {
char sourceAlphabet[N];
unsigned frequency;
} Symbol;
@mohamed-ennahdi
mohamed-ennahdi / MineSweeper.c
Created February 24, 2014 04:01
Mine Sweeper Contest Solution.
#include<stdio.h>
/*
* M is the maximum size that a line can take.
*/
#define M 100
/*
* N is the maximum size that a column can take.
*/
#define N 100
@mohamed-ennahdi
mohamed-ennahdi / DNASorting.c
Created February 24, 2014 04:03
DNA Sorting Contest Problem
/*
* Mohamed Ennahdi El Idrissi
*/
#include <stdio.h>
/*
* M is the length of the string ( 0 < M <= 100 )
*/
#define M 100
/*
@mohamed-ennahdi
mohamed-ennahdi / TournamentStandings.c
Created February 24, 2014 04:05
Tournament Standings Contest Problem.
#include <stdio.h>
/*
* Maximum number of tournaments we can have.
*/
#define MAX 1000 - 1
/*
* Maximum size of the description string.
*/
#define DESC 80 + 1
@mohamed-ennahdi
mohamed-ennahdi / PerfectHash.c
Created February 24, 2014 04:07
Perfect Hash Contest Problem.
#include <stdio.h>
#define LIST_MAX_SIZE 200
#define NUMBER_OF_WORDS 30
#define NUMBER_OF_CHARACTERS 5
typedef struct {
char word[NUMBER_OF_CHARACTERS];
int number;
int hashedNumber;