Git Product home page Git Product logo

lo21-exs's Introduction

lo21-exs

Exercises for "LO21" (algorithmics and programmation)

Installation

Note that you will need:

  • A relatively modern version of git
  • GNU Make
  • CMake, version 3.15 or higher
  • A C compiler that is C99-compliant (gcc, clang, ...)

Clone this repository:

# If you have git >= 2.13, then you may run the following:
git clone --recurse-submodules https://github.com/adri326/lo21-exs
cd lo21-exs

# If your git version is still running behind, you shall run:
git clone https://github.com/adri326/lo21-exs
cd lo21-exs
git submodule update --init --recursive

Then build the project:

mkdir build && cd build
cmake ..
make -j

Notes and initial definitions

The syntax for algorithms in this repository is a more distilled down form of what you'd find at school.

Following are initial definitions of algorithmical syntaxes used throughout this repository:

Operators

  • !=, "not equal to", infix, commutative
  • a..b, iterates over [a; b)
  • ::, references structure fields (eg. int_ll::next); note that this is different from field accessing (.)
  • ., field accessing, infix (eg. my_linkedlist.next); works with both plain structures and structure pointers
  • ++, list concatenation, infix, transitive
  • %, modulo (eg. 5 % 2 = 1)

Expression groups

For ease of writing, a more complex expression may be isolated into a set of instructions, followed by a return statement, which will yield the result of that return statement. Such an isolated section is enclosed within curly brackets {}:

x <- (a % 3) * 4 - 2 * max(b, 3)

is equivalent to:

x <- {
    res_a <- a % 3
    res_a <- res * 4
    res_b <- max(b, 3)
    return res_a - 2 * res_b
}

Structure allocation

The following syntax will be used to describe structure allocation and field attribution:

type {
    key_1: value_1,
    key_2: value_2,
    // ...
    key_n: value_n
}

Such a construct is equivalent to the following set of instructions:

{
    res <- allocate(type)
    res.key_1 = value_1
    res.key_2 = value_2
    // ...
    res.key_n = value_n
    return res
}

lo21-exs's People

Contributors

adri326 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.